Reputation: 33
import java.util.Calendar;
...
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date(1443351600000L));// set to 2015-9-27
calendar.add(Calendar.HOUR_OF_DAY, 23); // add 23 hours
I don't know why calendar is updated from 2015-09-27 00:00:00
to 2015-09-28 00:00:00
. I expect 2015-09-27 23:00:00
.
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date(1443351600000L));// set to 2015-9-28
calendar.add(Calendar.HOUR_OF_DAY, 23); // add 23 hours
And this one works fine. The result is 2015-09-28 23:00:00
.
Upvotes: 2
Views: 319
Reputation: 159086
There's only 23 hours in the day if Daylight Saving Time starts on 2015-9-27
.
Google search says the following starts Daylight Saving Time on Sep 27, 2015:
If you're in one of these places, there's your answer.
Upvotes: 1