Java Date Format ISO toIso8601(Date dateTime)

Here you can find the source of toIso8601(Date dateTime)

Description

Formats a Date as an ISO 8601 string in the UTC timezone.

License

Apache License

Declaration

public static String toIso8601(Date dateTime) 

Method Source Code

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License"); you may not

import java.text.DateFormat;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    /** ISO 8601 format for a complete date and time in UTC. */
    public static final DateFormat FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");

    /** Formats a {@link Date} as an ISO 8601 string in the UTC timezone. */
    public static String toIso8601(Date dateTime) {
        return FORMAT.format(dateTime);
    }/*from  ww w  .  j ava 2  s . c o  m*/
}

Related

  1. toISO8601(Date date)
  2. toIso8601(Date date)
  3. toISO8601(Date date)
  4. toISO8601(Date date)
  5. toIso8601(Date dateObj)
  6. toISO8601(Date pDate)
  7. toISO8601FileSystemCompatible(Calendar calendar)
  8. toISODate(String format, String value)
  9. toISODateRealTimeFormat(Date iDate)