Here you can find the source of convertToISO8601String(java.sql.Timestamp ts)
public static String convertToISO8601String(java.sql.Timestamp ts)
//package com.java2s; //License from project: Open Source License import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.ISODateTimeFormat; public class Main { public static String convertToISO8601String(java.sql.Timestamp ts) { DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); DateTime dateTime = new DateTime(ts.getTime(), DateTimeZone.UTC); String retval = fmt.print(dateTime); return retval; }//from w w w . j a v a 2 s. com public static String convertToISO8601String(long epochSeconds) { DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); DateTime dateTime = new DateTime(epochSeconds * 1000, DateTimeZone.UTC); String retval = fmt.print(dateTime); return retval; } }