Here you can find the source of timestampToISO8601(Date aDate)
public static String timestampToISO8601(Date aDate)
//package com.java2s; //License from project: Apache License import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String timestampToISO8601(Timestamp aTimestamp) { return timestampToISO8601(new Date(aTimestamp.getTime())); }//from ww w . j ava 2 s .co m public static String timestampToISO8601(long aTime) { return timestampToISO8601(new Date(aTime)); } public static String timestampToISO8601(Date aDate) { SimpleDateFormat format = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ssZ"); return format.format(aDate); } public static String format(String aFormat, long aDate) { SimpleDateFormat format = new SimpleDateFormat(aFormat); return format.format(new Date(aDate)); } }