Here you can find the source of getCurrentDate()
public static Date getCurrentDate()
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date getCurrentDate() { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String date = format.format(new Date()); try {/* ww w . j ava 2 s . c o m*/ return format.parse(date); } catch (ParseException e) { e.printStackTrace(); } return null; } }