I have a DatePicker in my activity. I want to store the selected date when the user clicks a button like this.
Date selectedDate=new Date(dp.getYear(), dp.getMonth(), dp.getDayOfMonth());
the problem is when the selected date is like today’s: Feb 15 2010
the date returned from the
selectedDate
is 3910-02-15, so the year is 3910 instead of 2011
what is wrong with this ?
Thanks
I got it, the problem is in the conversion of the selected year value to the date object then displaying it as a string. The date object constructor require the year value minus 1900.