Here you can find the source of getCurAllTime()
public static String getCurAllTime()
//package com.java2s; //License from project: Open Source License import java.sql.Timestamp; import java.text.SimpleDateFormat; public class Main { /************************************************************ * RETURN DATE STRING FORMAT "yyyy-MM-dd HH:mm:ss" ************************************************************/ public static String getCurAllTime() { Timestamp ts = null;// w w w. jav a 2 s . c om try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String d = sdf.format(new java.util.Date()); ts = Timestamp.valueOf(d); } catch (Exception ex) { ex.printStackTrace(); } return ts.toString().substring(0, 19); } }