Date to calendar
843789May 24 2010 — edited May 27 2010I have a class TestDate which extends Date . It has an constructor with 3 parameters
public TestDate(int year, int month, int day)
{
super(year, month, day);
}
public static TestDate getCurrentDate()
{
GregorianCalendar cal = new GregorianCalendar();
return new TestDate(cal.get(Calendar.YEAR)-1900,cal.get(Calendar.MONTH),cal.get(Calendar.DAY_OF_MONTH));*/
}
(Few methods of Date class in java 1.6 are deprecated so I m using calendar class.)
I have a user defined method which calls the constructor, and gets the current date by calling the constructor but
super(year, month, day) for Date is deprecated. Please can you suggest me the replacement for the constructor using calendar class.