Share this page 

Have year on 4 digits from a Date objectTag(s): Date and Time


You need to add 1900 to it to get the 4 digit year.
int year = myDate.getYear() + 1900;
The getYear() method returns the number of years elapsed after the year 1900. So for year 2000, mydate.getYear() will return 100. So 100 + 1900 = 2000.