Java Utililty Methods Date Format ISO

List of utility methods to do Date Format ISO

Description

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

Method

DateFormatgetIsoFormat()
Returns ISO DataFormat 'yyyy-MM-dd'T'HH:mm:ss.SSS'
SimpleDateFormat isoFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"); 
isoFormat.setTimeZone(TimeZone.getTimeZone("GMT")); 
return isoFormat;
StringgetISOFormat(java.util.Date date)
get ISO Format
return new SimpleDateFormat("yyyy-mm-dd hh:mm:ss").format(date);
StringgetISOFromMillisec(long timeMillisecGMT)
Returns time form ISO given millisec since EPOCH
formatISODefault.setTimeZone(TimeZone.getTimeZone("GMT"));
return formatISODefault.format(new Date(timeMillisecGMT));
DateFormatgetISOHttpDateFormat()
get ISO Http Date Format
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
TimeZone tZone = TimeZone.getTimeZone("GMT");
dateFormat.setTimeZone(tZone);
return dateFormat;
StringgetIsoTimeStamp()
Method getIsoTimeStamp.
return format(new Date(), fullIsoFormat);
SimpleDateFormatgetIsoTimestampFormatter()
get Iso Timestamp Formatter
return new SimpleDateFormat(ISO_TIMESTAMP_FORMAT);
StringgetJavaISO8601Time(Date date)
Returns the UTC date/time String for the specified value using Java's version of the ISO8601 pattern, which is limited to millisecond precision.
final DateFormat formatter = new SimpleDateFormat(JAVA_ISO8601_PATTERN, LOCALE_US);
formatter.setTimeZone(UTC_ZONE);
return formatter.format(date);
SimpleDateFormatgetSDFISO8601()
get SDFISO
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
sdf.setTimeZone(new SimpleTimeZone(SimpleTimeZone.UTC_TIME, "UTC")); 
return sdf;
StringgetShortISODateTime(final Date inDate)
get Short ISO Date Time
String isoDate = null;
SimpleDateFormat isoDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
if (inDate != null) {
    isoDate = isoDateFormat.format(inDate);
return isoDate;
Stringiso(Date date)
Formats the specified date using yyyy-MM-dd HH:mm:ss pattern.
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);