Android Long to Date Convert timestampToISO8601(long aTime)

Here you can find the source of timestampToISO8601(long aTime)

Description

timestamp To ISO

License

Apache License

Declaration

public static String timestampToISO8601(long aTime) 

Method Source Code

//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  a va  2  s.c  o 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));
    }
}

Related

  1. shortFromUtc(long milliseconds)
  2. timeInMillisToText(final long totalTimeInMillis)
  3. timeInMillisecondsToDateStringFull( long timeInMilliseconds)
  4. timestampToDate(long timeStamp)
  5. timestampToDate(long timeStamp)
  6. timestampToIso8601Str(long timestamp)
  7. timestampToIso8601Str(long timestamp)
  8. toCalendar(long hour)
  9. toDateString(long seconds)