Here you can find the source of formatDate(Date date)
Parameter | Description |
---|
public static String formatDate(Date date)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String formatDate(Date date, String patter) { try {/* ww w .j a v a2 s . co m*/ SimpleDateFormat sdf = new SimpleDateFormat(patter); return sdf.format(date); } catch (RuntimeException e) { return ""; } } public static String formatDate(Date date) { try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return sdf.format(date); } catch (RuntimeException e) { return ""; } } }