Here you can find the source of formatFromDate(Date date)
public static String formatFromDate(Date date)
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String FORMATER_YYYY_MM_DD = "yyyy-MM-dd"; public static String formatFromDate(Date date) { return formatFromDate(FORMATER_YYYY_MM_DD, date); }/*from w ww .j a v a2 s.c o m*/ public static String formatFromDate(String formater, Date date) { DateFormat df = new SimpleDateFormat(formater); return df.format(date); } }