Here you can find the source of getFormatDate(String format)
public static String getFormatDate(String format)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getFormatDate(Date date) { return getFormatDateTime(date, "yyyy-MM-dd"); }/* ww w .j av a 2s .co m*/ public static String getFormatDate(String format) { return getFormatDateTime(new Date(), format); } public static String getFormatDateTime(Date date, String format) { SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(date); } }