Here you can find the source of parseDate(String s)
public static Date parseDate(String s)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static Date parseDate(String s) { Calendar c = Calendar.getInstance(); try {/*w w w .java 2s . co m*/ int d = Integer.parseInt(s); int year = d / 10000; int month = (d % 10000) / 100; int day = d % 100; c.set(year, month - 1, day); } catch (Exception e) { return null; } return c.getTime(); } public static String getTime() { java.util.Date dt = new java.util.Date(); java.sql.Timestamp ts = new java.sql.Timestamp(dt.getTime()); String time = ts.toString(); return time.substring(0, 19); } }