Code example for SimpleDateFormat

Methods: format, setTimeZone

0
        return gprmc;
    } 
 
    public static String NMEAGPRMCTime(Date dateToFormat)
    { 
        SimpleDateFormat sdf = new SimpleDateFormat("HHmmss.SSS");
        sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
        return sdf.format(dateToFormat);
    } 
 
    public static String NMEAGPRMCDate(Date dateToFormat)
    { 
        SimpleDateFormat sdf = new SimpleDateFormat("ddMMyy");
        sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
        return sdf.format(dateToFormat);
    } 
 
    public static String NMEAGPRMCCoord(double coord)
    { 
        // “DDDMM.MMMMM” 
        int degrees = (int) coord;