DateUtilspublic class DateUtils extends Object Provides formatting date as string utilities |
Constructors Summary |
---|
private DateUtils()
|
Methods Summary |
---|
public static java.lang.String | getCurrentKMLTimestamp()Helper version of getKMLTimestamp, that returns timestamp for current
time
return getKMLTimestamp(System.currentTimeMillis());
| public static java.lang.String | getCurrentTimestamp()Returns timestamp in following format: yyyy-mm-dd-hh-mm-ss
Calendar c = Calendar.getInstance();
c.setTimeInMillis(System.currentTimeMillis());
return String.format("%tY-%tm-%td-%tH-%tM-%tS", c, c, c, c, c, c);
| public static java.lang.String | getKMLTimestamp(long when)Returns timestamp given by param in KML format ie yyyy-mm-ddThh:mm:ssZ,
where T is the separator between the date and the time and the time zone
is Z (for UTC)
TimeZone tz = TimeZone.getTimeZone("GMT");
Calendar c = Calendar.getInstance(tz);
c.setTimeInMillis(when);
return String.format("%tY-%tm-%tdT%tH:%tM:%tSZ", c, c, c, c, c, c);
|
|