Here you can find the source of getDate()
public static String getDate()
//package com.java2s; import java.util.Calendar; import java.sql.Date; public class Main { public static String getDate() { Calendar c = Calendar.getInstance(); int theYear = c.get(Calendar.YEAR) - 1900; int theMonth = c.get(Calendar.MONTH); int theDay = c.get(Calendar.DAY_OF_MONTH); //return (new GregorianCalendar(theYear, theMonth, theDay)).toString(); return (new Date(theYear, theMonth, theDay)).toString(); }/* w w w .j a v a 2 s . c o m*/ }