SimpleDateFormat parse () gives incorrect result

Dfault TimeZone GMT-3.00. I am processing a new date ("1900/01/01"). ToString using the parse SimpleDateFormat method.

The result I get is Sun Dec 31 23:15:16 UYT 1899 instead of Mon 01.01 00:00:00 UYT 1900

I do not understand why the result is different.

PS: If I changed TimeZone to GMT +5.30, the result will be as expected.

+7
source share
2 answers

According to the UYT time zone changes to timeanddate.com , the UYT time zone was UTC-3.44.44 to 1920, and not UTC-3.00, so that your result looks correct.

+7
source

Do you use this code?

SimpleDateFormat sdf = new SimpleDateFormat("yyyy/dd/MM"); System.out.println(sdf.parse("1900/01/01")); 

Perhaps you have the wrong characters ...

+1
source

All Articles