Here you can find the source of parseToString(Date date)
public static String parseToString(Date date)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String yyyyMMddHHmmss = "yyyy-MM-dd HH:mm:ss"; public static String parseToString(Date date) { return parseToString(date, yyyyMMddHHmmss); }/*w w w . j av a 2 s .co m*/ public static String parseToString(Date date, String style) { if (date == null) return null; SimpleDateFormat simpleDateFormat = new SimpleDateFormat(style); return simpleDateFormat.format(date); } }