Here you can find the source of dateTimeFormatterDate(Date date)
public static String dateTimeFormatterDate(Date date)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.*; public class Main { private static String defaultDatePattern = "yyyy-MM-dd"; public static SimpleDateFormat dateTimeFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public static String dateTimeFormatterDate(Date date) { if (date != null) { return dateTimeFormatter.format(date); }/*from w w w . j av a 2s . c o m*/ return ""; } public static String format(Date date) { return format(date, getDatePattern()); } public static String format(Date date, String pattern) { String returnValue = ""; if (date != null) { SimpleDateFormat df = new SimpleDateFormat(pattern); returnValue = df.format(date); } return (returnValue); } public static String getDatePattern() { return defaultDatePattern; } }