Java Utililty Methods UTC Date

List of utility methods to do UTC Date

Description

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

Method

GregorianCalendarcreateUtcCalendar()
create Utc Calendar
return new GregorianCalendar(TimeZone.getTimeZone("UTC"), Locale.ENGLISH);
StringformatUTC(Date time)
Date-Time formater that corresponds to the standard UTC time as used in XML
Calendar c = null;
if (c == null)
    c = Calendar.getInstance();
c.setTime(time);
return c.get(Calendar.YEAR) + "-" + formatInt2(c.get(Calendar.MONTH) + 1) + "-"
        + formatInt2(c.get(Calendar.DAY_OF_MONTH)) + "T" + formatInt2(c.get(Calendar.HOUR_OF_DAY)) + ":"
        + formatInt2(c.get(Calendar.MINUTE)) + ":" + formatInt2(c.get(Calendar.SECOND)) + "Z";
StringformatUTC(Date time)
Date-Time formatter that corresponds to the standard UTC time as used in XML
Calendar cal = Calendar.getInstance();
cal.setTime(time);
StringBuffer buf = new StringBuffer(20);
appendDate(buf, cal).append('T');
appendInt2(buf, cal.get(Calendar.HOUR_OF_DAY)).append(':');
appendInt2(buf, cal.get(Calendar.MINUTE)).append(':');
appendInt2(buf, cal.get(Calendar.SECOND)).append('Z');
return buf.toString();
...
ClassgetPlatypusConainerClass(Class aLayoutClass)
get Platypus Conainer Class
return layoutClasses2PlatypusContainerClasses.get(aLayoutClass);
TimeZonegetUTC()
get UTC
return TimeZone.getTimeZone(TIME_ZONE_UTC);
StringgetUTC(String beforeFormart, String afterFormart, String dateStr)
get UTC
SimpleDateFormat be = new SimpleDateFormat(beforeFormart, Locale.US);
Date date = be.parse(dateStr);
SimpleDateFormat af = new SimpleDateFormat(afterFormart, Locale.US);
String dateUtc = af.format(date);
return dateUtc;
CalendargetUTCCalendar()
Retrieve an UTC Calendar.
return Calendar.getInstance(UTC_TIME_ZONE);
CalendargetUTCCalendar()
get UTC Calendar
if (utcCal == null) {
    utcCal = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
return utcCal;
CalendargetUTCCalendar(Calendar value)
get UTC Calendar
if (value == null) {
    return (null);
Calendar cal = Calendar.getInstance(tzUTC);
cal.setTimeInMillis(value.getTimeInMillis());
return (cal);
CalendargetUTCCalendarFromDialogString(String dateString)
Convert a string date from a dialog date to a UTC calendar ready to be stored in the repository
SimpleDateFormat sdf = (dateString.length() > YYYY_MM_DD.length())
        ? new SimpleDateFormat(YYYY_MM_DD_T_HH_MM_SS)
        : new SimpleDateFormat(YYYY_MM_DD);
return getUTCCalendarFromLocalDate(sdf.parse(dateString));