Here you can find the source of formatDate(long millis)
Parameter | Description |
---|---|
millis | milliseconds since 1/1/1970 00:00:00 GMT |
public static String formatDate(long millis)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { private static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSX"; /**/*from ww w . j a v a 2 s .c o m*/ * Format date for QuakeML * * @param millis milliseconds since 1/1/1970 00:00:00 GMT * @return time string in yyyy-MM-dd'T'HH:mm:ss.SSSX format */ public static String formatDate(long millis) { SimpleDateFormat dateF = new SimpleDateFormat(DATE_FORMAT); dateF.setTimeZone(TimeZone.getTimeZone("UTC")); Date date = new Date(millis); return dateF.format(date); } }