List of utility methods to do Time in GMT
String | getGMT(Date date) get GMT FORMAT.setTimeZone(TimeZone.getTimeZone("GMT")); String dateString = FORMAT.format(date); return dateString; |
Date | getGMT8Time() get GMT Time Date gmt8 = null; try { Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+8"), Locale.CHINESE); Calendar day = Calendar.getInstance(); day.set(Calendar.YEAR, cal.get(Calendar.YEAR)); day.set(Calendar.MONTH, cal.get(Calendar.MONTH)); day.set(Calendar.DATE, cal.get(Calendar.DATE)); day.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY)); ... |
String | getGMTByDisplay(String tm) get special time zone offset String gmt = null; if (null == tm || "Default".equals(tm)) { return getDefaultID2GMT(); for (Entry<String, StringBuffer> en : normtoIDsMap.entrySet()) { String enKey = en.getValue().toString(); if (enKey.indexOf(tm) >= 0 || enKey.equalsIgnoreCase(tm)) { gmt = en.getKey(); ... |
Calendar | getGMTCalendarAtTime(String sTime) Gets the calendar at given time at GMT SimpleDateFormat dtFormat = new SimpleDateFormat(m_sDtFormat); Calendar newDate = getGMTCalendar(); newDate.setTime(dtFormat.parse(sTime)); return newDate; |
String | getGMTDate() get GMT Date SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss 'GMT'", Locale.US); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); return sdf.format(new Date()); |
SimpleDateFormat | getGMTDateFormat(String format) get GMT Date Format SimpleDateFormat df = new SimpleDateFormat(format); df.setTimeZone(TimeZone.getTimeZone("GMT")); return df; |
SimpleDateFormat | getGMTDateFormat(String strFormat) get GMT Date Format SimpleDateFormat format = new SimpleDateFormat(strFormat); format.setCalendar(getGMTCalendar()); return format; |
String | getGMTDateString(Date date) get GMT Date String SimpleDateFormat formatter = (SimpleDateFormat) DateFormat.getDateInstance(); TimeZone gmt = TimeZone.getTimeZone("GMT"); formatter.setTimeZone(gmt); formatter.applyPattern("dd MMMM"); String dayString = formatter.format(date); formatter = (SimpleDateFormat) DateFormat.getTimeInstance(); formatter.setTimeZone(gmt); formatter.applyPattern("hh:mm zzz yyyy"); ... |
String | getGMTDatetime(Date datetime) get GMT Datetime return RFC_822_DATE_FORMAT.get().format(datetime);
|
SimpleDateFormat | getGMTDatetimeFormat() get GMT Datetime Format return new SimpleDateFormat(GMT_DATETIME_FORMAT_PATTERN); |