Here you can find the source of getCurrentDateInSqlFormat()
public static String getCurrentDateInSqlFormat()
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final SimpleDateFormat SQL_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public static String getCurrentDateInSqlFormat() { Date currentDate = new Date(); return dateToSqlFormat(currentDate); }/*from www . j av a 2 s. c o m*/ public static String dateToSqlFormat(Date date) { return SQL_DATE_FORMAT.format(date); } }