Java Date Format As formatDateUTC(Date d)

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

Description

format Date UTC

License

Open Source License

Declaration

public static String formatDateUTC(Date d) 

Method Source Code


//package com.java2s;
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt

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

public class Main {
    public static final String ISO8601_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm'Z'";
    public static final TimeZone UTC = TimeZone.getTimeZone("UTC");

    public static String formatDateUTC(Date d) {
        return (d != null) ? getISO8601DateFormat().format(d) : "NULL";
    }/*w w  w  .  j  av a2s  .  com*/

    public static DateFormat getISO8601DateFormat() {
        DateFormat dateFormat = new SimpleDateFormat(ISO8601_DATE_FORMAT);
        dateFormat.setTimeZone(UTC);
        return dateFormat;
    }
}

Related

  1. formatDateToMD(Date date)
  2. formatDateToMinutes(Date date)
  3. formatDateToUTC(Date date)
  4. formatDateToUTC(final Date date)
  5. formatDateUsingW3C(Date date)
  6. formatDateUTC(Date date)
  7. formatDateW3C(Date date)
  8. formatDateWithMilliseconds(DateFormat aFormat, Date aDate)
  9. formatDateYMD(Object date)