Here you can find the source of formatDateUsingW3C(Date date)
Parameter | Description |
---|---|
date | a parameter |
Parameter | Description |
---|---|
DatatypeConfigurationException | an exception |
public static String formatDateUsingW3C(Date date)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**//from ww w. j ava 2s .c o m * Use to produce date Strings in the W3C date format * * @param date * @return * @throws DatatypeConfigurationException */ public static String formatDateUsingW3C(Date date) { String w3cDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(date); return w3cDate = w3cDate.substring(0, 22) + ":" + w3cDate.substring(22, 24); } }