Skip to content

Instantly share code, notes, and snippets.

@mtritschler
Last active December 31, 2015 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtritschler/8002743 to your computer and use it in GitHub Desktop.
Save mtritschler/8002743 to your computer and use it in GitHub Desktop.
java.util.Calendar WTF
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