List of utility methods to do Calendar UTC
Calendar | getUTCCalendar(Date date) get UTC Calendar Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("utc"), Locale.getDefault()); cal.setTime(date); return cal; |
Calendar | getUTCCalendarFromLocalDate(Date date) Convert a local date time to a UTC calendar Calendar instance = Calendar.getInstance(UTC_TIME_ZONE);
instance.setTimeInMillis(date.getTime());
return instance;
|
Calendar | getUTCCalendarInstance() Get an instance of a Calendar object with a UTC time zone. return Calendar.getInstance(new SimpleTimeZone(0, "UTC"), Locale.ENGLISH); |
double | getUtcMillisFromEpoch(Calendar calendar) get Utc Millis From Epoch if (calendar == null) { calendar = new GregorianCalendar(); return calendar.getTimeInMillis(); |
long | subtractFromUTCMilliSeconds(int calendarTime, int actualValue) Subtract given minutes/hours/seconds to actual calendar time . final Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); calendar.add(calendarTime, -actualValue); return calendar.getTimeInMillis(); |