Here you can find the source of formatDate(Date date)
Parameter | Description |
---|---|
date | is the date to format |
public static String formatDate(Date date)
//package com.java2s; //License from project: LGPL import java.text.SimpleDateFormat; import java.util.Date; public class Main { /** example 2012-09-26T00:00:00. */ private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); /**//from ww w. j a v a2 s . co m * Synchronized format of date to string using {@link #DATE_FORMAT} * * @param date * is the date to format * @return the formated date with {@link #DATE_FORMAT} */ public static String formatDate(Date date) { synchronized (DATE_FORMAT) { return DATE_FORMAT.format(date); } } }