Pages

Tuesday, November 11, 2014

Convert Timet to UTC

This piece of code gets the current time in UTC


SimpleDateFormat f = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss");
f.setTimeZone(TimeZone.getTimeZone("UTC"));
System.out.println(f.format(new Date()));




No comments: