What is the correct string to set the DateFormat timezone to GMT+1? According the documentation it should be something like "GMT + 00:00". I already tried other forms but apparently I always fallback to GMT (my current timezone).
Thanks in advance!
You can use
TimeZone fixedUtcPlus1 = new SimpleTimeZone(TimeUnit.HOURS.toMillis(1),
"GMT+1");
format.setTimeZone(fixedUtcPlus1);
Or just:
TimeZone zone = TimeZone.getTimeZone("GMT+1");
format.setTimeZone(zone);
(Apologies for the repeated edits around +1 and -1... bad diagnostics on my part. "GMT+1" is fine, but its Etc equivalent is "Etc/GMT-1" - very confusing.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With