Here you can find the source of timestampToIso8601Str(long timestamp)
public static String timestampToIso8601Str(long timestamp)
//package com.java2s; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { private static final ThreadLocal<DateFormat> ISO8601Format = new ThreadLocal<DateFormat>() { @Override/* ww w. j a v a 2s. c o m*/ protected DateFormat initialValue() { return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.US); } }; public static String timestampToIso8601Str(long timestamp) { return javaDateToIso8601(timestampToDate(timestamp)); } public static String javaDateToIso8601(Date date) { if (date == null) return ""; DateFormat formatter = ISO8601Format.get(); return formatter.format(date); } public static Date timestampToDate(long timeStamp) { return new java.util.Date(timeStamp * 1000); } }