Here you can find the source of convertTimeToString(Date date, String pattern)
public static String convertTimeToString(Date date, String pattern)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd"; public static String convertTimeToString(Date date) { return convertTimeToString(date, DEFAULT_DATE_FORMAT); }/*ww w .ja v a 2 s . c om*/ public static String convertTimeToString(Date date, String pattern) { SimpleDateFormat sdf = new SimpleDateFormat(pattern); return sdf.format(date); } }