Java Timestamp Convert To convertToISO8601String(java.sql.Timestamp ts)

Here you can find the source of convertToISO8601String(java.sql.Timestamp ts)

Description

convert To ISO String

License

Open Source License

Declaration

public static String convertToISO8601String(java.sql.Timestamp ts) 

Method Source Code

//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;
    }
}

Related

  1. convertTimestampToString(Timestamp str)
  2. convertTimestampToStringWithoutTime(final Timestamp ts)
  3. convertToDate(Timestamp aTimeStamp)
  4. convertToDate(Timestamp timestamp)
  5. convertToEpochMillis(java.sql.Timestamp ts)
  6. convertToString(Timestamp dateData, String pattern, Locale locale)
  7. timestamp(Timestamp timestamp)
  8. Timestamp2Arch(Timestamp ts)
  9. timestamp2Calendar(Timestamp ts)