Java Utililty Methods Calendar UTC

List of utility methods to do Calendar UTC

Description

The list of methods to do Calendar UTC are organized into topic(s).

Method

CalendargetUTCCalendar(Date date)
get UTC Calendar
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("utc"), Locale.getDefault());
cal.setTime(date);
return cal;
CalendargetUTCCalendarFromLocalDate(Date date)
Convert a local date time to a UTC calendar
Calendar instance = Calendar.getInstance(UTC_TIME_ZONE);
instance.setTimeInMillis(date.getTime());
return instance;
CalendargetUTCCalendarInstance()
Get an instance of a Calendar object with a UTC time zone.
return Calendar.getInstance(new SimpleTimeZone(0, "UTC"), Locale.ENGLISH);
doublegetUtcMillisFromEpoch(Calendar calendar)
get Utc Millis From Epoch
if (calendar == null) {
    calendar = new GregorianCalendar();
return calendar.getTimeInMillis();
longsubtractFromUTCMilliSeconds(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();