I got a date from server in the form E, dd MMM yyyy HH:mm:ss Z where timezone is +0200
I parse it in my own format yyyy-MM-dd HH:mm:ss using
myFormat.format(serverFormat.parse(dateString));
and I get time wrong: it’s one hour before. So, if I get 10:00 in conversion I get 09:00. Why?
I believe that the problem here is DST – Daylight saving time. The standard is winter time. It is a summer now, so you get 1 hour difference.
You are using timezone shift syntax
+0200that does not and cannot support daylight saving because it depends on country.You should use locale specific syntax of time zone definition, e.g.
Europe/Amsterdaminstead of+0100. In addition take a look on API of classTimeZone:inDaylightTime(Date date)useDaylightTime()