Question about week granularity elasticsearch uses

Hello,

I stepped into a situation where I need to truncate a timestamp field
truncated to the week, and i want to do it the exact way elasticsearch does
it in the datehistogram aggregation in order to be able to perform
comparisons. Does anyone knows how I should perform the truncate to the
week? I notice that datehistogram returns the beginning of the week
(MONDAY), is it safe to use the Calendar way as follows?

Calendar cal = Calendar.getInstance();

cal.setTimeZone(TimeZone.getTimeZone("GMT"));
// cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
Date time = cal.getTime();
System.out.println("time = " + time);

Is the first day of week depends on the Locale in elasticsearch or not?

Thank you

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4d763e87-d1ab-491f-af7e-8a0b4ba71d39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.