Here you can find the source of getDateTime()
public static Timestamp getDateTime()
//package com.java2s; //License from project: Apache License import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Timestamp getDateTime() { return Timestamp.valueOf(getFormatDate("yyyy-MM-dd HH:mm:ss")); }//from w w w. ja va 2s . c om public static Timestamp getDateTime(String datetime) { return Timestamp.valueOf(datetime); } protected static String getFormatDate(String formatString) { String currentDate = ""; SimpleDateFormat format1 = new SimpleDateFormat(formatString); currentDate = format1.format(new Date()); return currentDate; } }