Here you can find the source of DateTimeToString(Date date)
public static String DateTimeToString(Date date)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String DateTimeToString(Date date) { String _pattern = "yyyy-MM-dd HH:mm:ss"; return date == null ? null : DateToString(date, _pattern); }// w w w . j a v a 2 s . com public static String DateToString(Date date, String pattern) { String strDateTime = null; SimpleDateFormat formater = new SimpleDateFormat(pattern); strDateTime = date == null ? null : formater.format(date); return strDateTime; } public static String DateToString(Date date) { String _pattern = "yyyy-MM-dd"; return date == null ? null : DateToString(date, _pattern); } }