I\'m trying to convert a millisecond time (milliseconds since Jan 1 1970) to a time in UTC in Java. I\'ve seen a lot of other questions that utilize SimpleDateFormat to chan
Try below..
package com.example;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
public class TestClient {
/**
* @param args
*/
public static void main(String[] args) {
long time = 1427723278405L;
SimpleDateFormat sdf = new SimpleDateFormat();
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
System.out.println(sdf.format(new Date(time)));
}
}