Android Utililty Methods GMT Date Get

List of utility methods to do GMT Date Get

Description

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

Method

StringgetGMTDate()
get GMT Date
return getGMTDate(new Date());
StringgetGMTDate(Date date)
get GMT Date
if (date == null) {
    return null;
DateFormat dateFormat = new SimpleDateFormat(
        "E, dd MMM yyyy HH:mm:ss 'GMT'", Locale.ENGLISH);
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
String dateStr = dateFormat.format(date);
return dateStr;
...
DategetGMTDateFromString(String dateStr)
get GMT Date From String
return getDateFromString("E, dd MMM yyyy HH:mm:ss 'GMT'", dateStr);
longgetMillisGMT()
get Millis GMT
Calendar calendar = new GregorianCalendar();
TimeZone mTimeZone = calendar.getTimeZone();
int offset = mTimeZone.getOffset(System.currentTimeMillis());
return System.currentTimeMillis() - offset;
StringmillisToGMT(long millis)
millis To GMT
SimpleDateFormat df = new SimpleDateFormat("MM_dd_yyyy_hh_mm",
        Locale.getDefault());
df.setTimeZone(TimeZone.getTimeZone("GMT"));
return df.format(millis) + "_UTC";