I'am playing with Java Date and can't understand this:
Date myBirth = new Date(1991,01,21);
Log.d("DATE: ", "" + myBirth);
Here I initialized Date object. Why I get this output?
DEBUG/DATE:(31693): Sat Feb 21 00:00:00 EET 3891
From the Date docs :
- A year y is represented by the integer y - 1900.
- A month is represented by an integer from 0 to 11; 0 is January, 1 is February, and so forth; thus 11 is December.
Quoting from the Javadoc of this deprecated constructor of Date:
Parameters:
year - the year **minus 1900**.
month - the month between 0-11.
date - the day of the month between 1-31.
So the output is what you ask, but not what you want.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.