set default timezone
This commit is contained in:
parent
d12be45fe1
commit
98010d02e4
|
@ -16,10 +16,11 @@ public class DaylightSavingTimeExamplesTest {
|
|||
|
||||
@Test
|
||||
public void givenItalianTimeZone_WhenDSTHappens_ThenCorrectlyShiftTimeZone() throws ParseException {
|
||||
TimeZone.setDefault(TimeZone.getTimeZone("Europe/Rome"));
|
||||
|
||||
TimeZone tz = TimeZone.getTimeZone("Europe/Rome");
|
||||
Calendar cal = Calendar.getInstance(tz, Locale.ITALIAN);
|
||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.ITALIAN);
|
||||
df.setTimeZone(tz);
|
||||
Date dateBeforeDST = df.parse("2018-03-25 01:55");
|
||||
prettyPrint(cal.getTimeZone());
|
||||
|
||||
|
|
Loading…
Reference in New Issue