Java Date Format ISO formatISODateTime(Date date)

Here you can find the source of formatISODateTime(Date date)

Description

Format Date into ISO 8601 full datetime string.

License

Open Source License

Parameter

Parameter Description
date to format

Return

formatted string

Declaration

public static final String formatISODateTime(Date date) 

Method Source Code


//package com.java2s;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    protected static final SimpleDateFormat ISO_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SZ");

    /**//from  w  ww.  j  av  a 2s.c o  m
     * Format Date into ISO 8601 full datetime string.
     * 
     * @param date to format
     * @return formatted string
     */
    public static final String formatISODateTime(Date date) {
        if (date == null)
            return null;
        synchronized (ISO_DATE_FORMAT) {
            return ISO_DATE_FORMAT.format(date);
        }
    }
}

Related

  1. formatISO8601Date(final java.util.Date date)
  2. formatISO8601DateWOTime(final java.util.Date date)
  3. formatIso8601ForCCTray(Date date)
  4. formatIsoDate(Date date)
  5. formatISODate(Date date)
  6. formatOneDecimal(int iNumber, int iDivisor)
  7. formattedIso8601DateString(Calendar pCal)
  8. formatTimestampIso8601(long millis, TimeZone zone)
  9. formatToIso8601(Date d)