Here you can find the source of getISO8601Time()
Get current moment in ISO 8601 format http://stackoverflow.com/questions/3914404/how-to-get-current-moment-in-iso-8601-format 2016-01-20T10:53:52.457+08:00 2016-01-20T10:53:52.457+0800 2016-01-20T11:11:42.915Z
public static String getISO8601Time()
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**// w w w . jav a 2s. co m * Get current moment in ISO 8601 format * http://stackoverflow.com/questions/3914404/how-to-get-current-moment-in-iso-8601-format * 2016-01-20T10:53:52.457+08:00 * 2016-01-20T10:53:52.457+0800 * 2016-01-20T11:11:42.915Z */ public static String getISO8601Time() { // Choose one from the following two lines. DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); // DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); // Uncomment and modify the following line if you would like set the timezone explicitly. // df.setTimeZone(TimeZone.getTimeZone("Asia/Taipei")); return df.format(new Date()); } }