Here you can find the source of getDateAsISOString(Date date)
Parameter | Description |
---|---|
date | Date to create string representation for for. |
public static String getDateAsISOString(Date date)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; import javax.xml.bind.DatatypeConverter; public class Main { /**/* ww w . j a v a2 s . co m*/ * Creates a string representation of the a date. * @param date Date to create string representation for for. * @return ISO 8601 formatted date time string. */ public static String getDateAsISOString(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); return DatatypeConverter.printDateTime(cal); } }