FileDocCategorySizeDatePackage
DateUtils.javaAPI DocAndroid 5.1 API1884Thu Mar 12 22:22:44 GMT 2015com.android.locationtracker.data

DateUtils

public class DateUtils extends Object
Provides formatting date as string utilities

Fields Summary
Constructors Summary
private DateUtils()


    
Methods Summary
public static java.lang.StringgetCurrentKMLTimestamp()
Helper version of getKMLTimestamp, that returns timestamp for current time

        return getKMLTimestamp(System.currentTimeMillis());
    
public static java.lang.StringgetCurrentTimestamp()
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.StringgetKMLTimestamp(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)

return
KML timestamp as String

        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);