Java Date ISO Parse getISOStringFromDate(long time)

Here you can find the source of getISOStringFromDate(long time)

Description

get ISO String From Date

License

Open Source License

Parameter

Parameter Description
time -

Return

-

Declaration

@SuppressWarnings("nls")
public static String getISOStringFromDate(long time) 

Method Source Code

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

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

public class Main {
    /**//w  w  w .  j av  a2  s .co m
     * 
     */
    public static final String ISO_8601_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";

    /**
     * @param time -
     * @return -
     */
    @SuppressWarnings("nls")
    public static String getISOStringFromDate(long time) {
        SimpleDateFormat sdf = new SimpleDateFormat(ISO_8601_FORMAT);
        sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
        return sdf.format(new Date(time));
    }

    /**
     * @param date -
     * @return -
     */
    public static String getISOStringFromDate(Date date) {
        SimpleDateFormat sdf = new SimpleDateFormat(ISO_8601_FORMAT);
        sdf.setTimeZone(TimeZone.getTimeZone("UTC")); //$NON-NLS-1$
        return sdf.format(date);
    }
}

Related

  1. getADTimeFromISO8601Date(String date)
  2. getCalendarFromISO8601String(final String timestamp, final TimeZone tz)
  3. getISODate(String date)
  4. getISODateInSeconds(String isoDate)
  5. getIsoStringDate(Date date)
  6. iso8601(String date)
  7. iso86012date(String s)
  8. iso8601ToCalendar(String s)
  9. iso8601ToDate(String s)