import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
public class scratch {
public static void main (String args[]) {
Date now = new Date();
SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss");
sdf.setTimeZone (TimeZone.getTimeZone ("UTC"));
System.out.println ("Time in UTC is " + sdf.format (now));
}
}
This outputs:
Time in UTC is 2011-04-11 13:40:04
0 個回應:
張貼留言