Here you can find the source of formateDate(Date date)
public static String formateDate(Date date)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String BASE_PATTERN = "yyyy-MM-dd HH:mm:ss"; public static String formateDate(Date date) { return formateDate(date, BASE_PATTERN); }// ww w .jav a2s. c om public static String formateDate(Date date, String pattern) { if (date == null) return null; SimpleDateFormat formatter = new SimpleDateFormat(pattern); return formatter.format(date); } }