Last active
April 14, 2016 08:06
-
-
Save macsystems/44e1e3e56b14dbc1478b8a8cd7ea9254 to your computer and use it in GitHub Desktop.
Timezones problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void timezoneProblem() throws ParseException { | |
TimeZone utcTime = TimeZone.getTimeZone("UTC"); | |
TimeZone berlinTime = TimeZone.getTimeZone("Europe/Berlin"); | |
Calendar calendar = new GregorianCalendar(); | |
calendar.setTimeZone(utcTime); | |
int hourOfDay_1 = calendar.get(Calendar.HOUR_OF_DAY); | |
calendar.setTimeZone(berlinTime); | |
int hourOfDay_2 = calendar.get(Calendar.HOUR_OF_DAY); | |
assertEquals("Hours should be not equal as as there are from different timezones:",hourOfDay_1, hourOfDay_2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment