Saulius S
Saulius S

Reputation: 401

Java simpleDateFormat conversion

trying to perform date comparison however:

date1=new SimpleDateFormat("yy-MM-dd HH").parse("12-03-25 02") is equal to

date2=new SimpleDateFormat("yy-MM-dd HH").parse("12-03-25 03")

What is the problem? Taking date1.getHour i get 3.

Ideas are welcome

Upvotes: 3

Views: 118

Answers (1)

JB Nizet
JB Nizet

Reputation: 691635

The 25th of March 2012 is the day where daylight saving time switch is done is many countries, typically at 2 o'clock. So 2AM and 3AM are the same time this day, in your locale. That's why you're seeing this.

Upvotes: 4

Related Questions