Here you can find the source of dateToString(Date date)
Parameter | Description |
---|---|
date | a parameter |
public static String dateToString(Date date)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { /**//from w w w . j av a 2 s . c o m * Converts Date type to String based on RFC3339 formatting * * @param date * @return String */ public static String dateToString(Date date) { final TimeZone utc = TimeZone.getTimeZone("UTC"); SimpleDateFormat tformat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); tformat.setTimeZone(utc); return tformat.format(date); } }