Java Date Format ISO getISO8601DateString(Date d)

Here you can find the source of getISO8601DateString(Date d)

Description

get ISO Date String

License

Open Source License

Declaration

public static String getISO8601DateString(Date d) 

Method Source Code


//package com.java2s;
/* J_LZ_COPYRIGHT_BEGIN *******************************************************
* Copyright 2001-2004, 2008, 2011 Laszlo Systems, Inc.  All Rights Reserved.  *
* Use is subject to license terms.                                            *
* J_LZ_COPYRIGHT_END *********************************************************/

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

public class Main {
    public static String getISO8601DateString(Date d) {
        DateFormat dfm = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.ENGLISH);
        dfm.setTimeZone(TimeZone.getTimeZone("GMT"));
        return dfm.format(d);
    }/*w ww  . j a  v  a  2 s.c  o  m*/
}

Related

  1. getIso8601DateFormat()
  2. getIso8601DateFormat()
  3. getISO8601DateFormat()
  4. getIso8601DateFormat()
  5. getISO8601DateFormat(TimeZone tz, String mask)
  6. getIso8601DateString(long timestampWithMilliseconds)
  7. getIso8601DayDateFormat()
  8. getISO8601FormatDate(String in)
  9. getIso8601String(Date d)