Have year on 4 digits from a Date objectTag(s): Date and Time
About cookies on this site
We use cookies to collect and analyze information on site performance and usage,
to provide social media features and to enhance and customize content and advertisements.
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.