Java Date Format ISO formatToISO8601(Date date)

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

Description

Formata a data para o formato ISO8601 usado pelo elastic search

License

LGPL

Parameter

Parameter Description
date a parameter

Declaration

public static String formatToISO8601(Date date) 

Method Source Code

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

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

public class Main {
    /**//w  w w  .ja v  a 2s .c  o m
     * Formata a data para o formato ISO8601 usado 
     * pelo elastic search
     * @param date
     * @return
     */
    public static String formatToISO8601(Date date) {
        String formatted = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
                .format(date);
        return formatted.substring(0, 22) + ":" + formatted.substring(22);
    }
}

Related

  1. formatISODateTime(Date date)
  2. formatOneDecimal(int iNumber, int iDivisor)
  3. formattedIso8601DateString(Calendar pCal)
  4. formatTimestampIso8601(long millis, TimeZone zone)
  5. formatToIso8601(Date d)
  6. formatWikiISO8601(Date d)
  7. fromIso8601(@Nullable String date)
  8. fromIso8601(String iso)
  9. get_ISO_8601()