Here you can find the source of getCurSQLDateInString(String pstrDateFormat)
public static String getCurSQLDateInString(String pstrDateFormat)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; public class Main { /**/*from ww w .j a va2 s. c o m*/ * Get current date in form of java.sql.Date and then convert it into * String. The return date string follow that of the input param DateFormat. * * @return String representation of current date. */ public static String getCurSQLDateInString(String pstrDateFormat) { String pstrDateTime = null; if ((pstrDateFormat != null) && (!pstrDateFormat.equals(""))) { java.util.Date curDateTime = new java.util.Date(); java.sql.Date curSqlDateTime = new java.sql.Date(curDateTime.getTime()); SimpleDateFormat sdf = new SimpleDateFormat(pstrDateFormat); pstrDateTime = sdf.format(curSqlDateTime); } return pstrDateTime; } }