Java Utililty Methods Date GMT Format

List of utility methods to do Date GMT Format

Description

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

Method

StringformatDateTimeGMT(Date date)
format Date Time GMT
return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG).format(date);
StringformatGMT(Date date)
format GMT
assert (date != null);
SimpleDateFormat format = new SimpleDateFormat(DATE_TIME_PATTERN);
format.setTimeZone(TIME_ZONE_GMT);
return format.format(date);
StringformatGMT(Date date, String parttern)
format GMT
if (date == null) {
    return "";
if (parttern == null || parttern.equals("")) {
    return "";
SimpleDateFormat formater = new SimpleDateFormat(parttern, Locale.ENGLISH);
formater.setTimeZone(GMT);
...
StringformatGmtDate(Date date)
format Gmt Date
SimpleDateFormat df = new SimpleDateFormat(GMT_DATE_FORMAT, Locale.US);
df.setTimeZone(TimeZone.getTimeZone("GMT"));
return df.format(date);
StringformatGMTDate(Date gmtTime, int offset)
format date to show in web pages, with default time format, since 2005/09/13
return formatGMTDate(gmtTime, DEFAULT_DATE_FORMAT, offset);
StringgetDefaultID2GMT()
default timezone to GMT
return getGMTFormat(TimeZone.getDefault().getID());
StringgetFormattedGMTDate(long timestamp)
get Formatted GMT Date
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
cal.setTimeInMillis(timestamp);
return formatter.format(cal.getTime());
SimpleDateFormatgetNewGmtSimpleDateFormat(String format)
get New Gmt Simple Date Format
return getNewGmtSimpleDateFormat(format, true);
StringgetStringBaseGMT(Date date, String timezone)
get String Base GMT
return dateToString(getDateBaseGMT(date, timezone));
ThreadLocalgetThreadLocalGMTDateFormat(final String format)
get Thread Local GMT Date Format
return new ThreadLocal<SimpleDateFormat>() {
    @Override
    protected SimpleDateFormat initialValue() {
        return getGMTDateFormat(format);
};