Java Date Format ISO formatAlternativeIso8601Date(Date date)

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

Description

format Alternative Iso Date

License

Apache License

Declaration

public static String formatAlternativeIso8601Date(Date date) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.DateFormat;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.SimpleTimeZone;

public class Main {
    private static final String ALTERNATIVE_ISO8601_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";

    public static String formatAlternativeIso8601Date(Date date) {
        return getAlternativeIso8601DateFormat().format(date);
    }/*from  w w  w . j  av a2  s. c  om*/

    private static DateFormat getAlternativeIso8601DateFormat() {
        SimpleDateFormat df = new SimpleDateFormat(ALTERNATIVE_ISO8601_DATE_FORMAT, Locale.US);
        df.setTimeZone(new SimpleTimeZone(0, "GMT"));
        return df;
    }
}

Related

  1. createISODateTimeFormatter()
  2. format(BigDecimal num, int divisor)
  3. formatAsIso8601Timestamp(Date date)
  4. formatAwsFlavouredISO8601Date(Date date)
  5. formatDateAsIsoDate(Calendar calendar)
  6. formatDateAsIsoString(Date date)