Last active
December 31, 2015 14:49
-
-
Save mtritschler/8002743 to your computer and use it in GitHub Desktop.
java.util.Calendar WTF
This file contains 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
import java.util.Calendar; | |
import java.util.TimeZone; | |
public class WTF { | |
public static void main(String... args) { | |
Calendar constructorTimezone = Calendar.getInstance(TimeZone.getTimeZone("GMT+12:00")); | |
constructorTimezone.set(2000, Calendar.JANUARY, 1); | |
Calendar setterTimezone = Calendar.getInstance(); | |
setterTimezone.setTimeZone(TimeZone.getTimeZone("GMT+12:00")); | |
setterTimezone.set(2000, Calendar.JANUARY, 1); | |
System.out.println(constructorTimezone.getTime()); | |
System.out.println(setterTimezone.getTime()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment