Android Utililty Methods Time Get

List of utility methods to do Time Get

Description

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

Method

StringgetTimestamp()
generate current timestamp
return "" + (System.currentTimeMillis() / 1000);
longgetUTCTime()
get UTC Time
Calendar cal = Calendar.getInstance(Locale.CHINA);
int zoneOffset = cal.get(java.util.Calendar.ZONE_OFFSET);
int dstOffset = cal.get(java.util.Calendar.DST_OFFSET);
cal.add(java.util.Calendar.MILLISECOND, -(zoneOffset + dstOffset));
return cal.getTimeInMillis();
longgetUnixTime()
get Unix Time
return (new Date()).getTime() / 1000;
longgetUnixTime()
get Unix Time
return (long) (System.currentTimeMillis() / 1000);