Java Date Format ISO millisecondsToISO8601(long date)

Here you can find the source of millisecondsToISO8601(long date)

Description

Converts the date and time provided in numbers of milliseconds since the epoch to a ISO8601 date and time representation (UTC to the millisecond).

License

Open Source License

Parameter

Parameter Description
date milliseconds since the epoch

Return

ISO8601 date and time

Declaration

public static String millisecondsToISO8601(long date) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    /**/*w  w  w  . ja  v  a 2s  .c  om*/
     * A date format for IS8601 date and time representation. This representation
     * is to the millisecond in UTC time.
     */
    private static final SimpleDateFormat ISO8601_DATE_FORMAT = new SimpleDateFormat(
            "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");

    /**
     * Converts the date and time provided in numbers of milliseconds since the
     * epoch to a ISO8601 date and time representation (UTC to the millisecond).
     * 
     * @param date  milliseconds since the epoch
     * @return      ISO8601 date and time
     * @since       1.3
     */
    public static String millisecondsToISO8601(long date) {
        return ISO8601_DATE_FORMAT.format(new Date(date));
    }
}

Related

  1. isoDateTimeUTC(final Date val)
  2. isoFormat(Date date)
  3. isoTime(Date d)
  4. longToISODate(long longDate)
  5. makeDateISO8601(Date date)
  6. NowFormatISO()
  7. nowISO8601()
  8. parseISODateFormat(String dateStr)
  9. parseIsoDateTime(final String isoDateString, final String dateFormat)