Here you can find the source of formatDate(Date date)
Parameter | Description |
---|---|
date | a parameter |
public static final String formatDate(Date date)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd"); /**// w w w. jav a2 s. c om * Format the Date object to string with format "yyyy-MM-dd" * @param date * @return */ public static final String formatDate(Date date) { if (date != null) { synchronized (SDF) { return SDF.format(date); } } else { return null; } } }