Here you can find the source of getTime(DateFormat df)
public static String getTime(DateFormat df)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final DateFormat standard = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss"); public static String getTime() { return standard.format(new Date()); }/*ww w .j a v a 2 s . c om*/ public static String getTime(DateFormat df) { return df.format(new Date()); } public static String getTime(Date date, DateFormat df) { return df.format(date); } public static String getTime(long time) { return standard.format(new Date(time)); } }