Here you can find the source of getDate()
public static String getDate()
//package com.java2s; //License from project: Open Source License import java.sql.Timestamp; import java.text.SimpleDateFormat; public class Main { /************************************************************ * RETURN DATE/*w w w . j a va 2s . co m*/ ************************************************************/ public static String getDate() { Timestamp ts = null; 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(8, 10); } }