Java SimpleDateFormat provides a different time zone for different days

I had strange behavior when parsing dates. Considering,

DateFormat sdf= new SimpleDateFormat("dd/MM/yyyy");

sdf.parse("25/10/2014")returns October 25, 2014 00:00:00 BST

and

sdf.parse("27/10/2014")returns October 27, 2014 00:00:00 GMT

I realized that due to the change in Daylight Time, but of course I expected the same time zone to be returned by the same parser. Or am I wrong?

+4
source share
2 answers

Wikipedia article about British Daylight Saving

During British Daylight Saving Time (BST), civil time in the United Kingdom advances one hour ahead of GMT (GMT), so that evening there is more daylight and less morning

BST 01:00 01:00 (02:00 BST) .

2014 26-. , TimeZone GMT, .

TimeZone - TimeZone, , , .

+5

SimpleDateFormat#parse(String ParsePosition):

TimeZone , text. TimeZone, setTimeZone() .

: , .

0

All Articles