Here you can find the source of getDate()
public static String getDate()
//package com.java2s; import java.sql.Date; import java.util.Calendar; 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 Date(theYear, theMonth, theDay)).toString(); }//from w ww . j a v a2s . c o m }