Here you can find the source of getDate(String format)
public static String getDate(String format)
//package com.java2s; //License from project: Apache License import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static String TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; public static String getDate(String format) { String d = new SimpleDateFormat(format).format(Calendar.getInstance().getTime()); return d; }//from w w w .j a v a2 s .c om public static Timestamp getTime() { String day = new SimpleDateFormat(TIME_FORMAT).format(Calendar.getInstance().getTime()); return Timestamp.valueOf(day); } }