Here you can find the source of formatToISO8601(Date date)
Parameter | Description |
---|---|
date | a parameter |
public static String formatToISO8601(Date date)
//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); } }