Created
August 28, 2014 15:20
-
-
Save rkroll/f5fafbb42b2fca101333 to your computer and use it in GitHub Desktop.
funky java date
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
@Test | |
public void testDate() { | |
{ | |
Date date = new Date(1325376000000l); | |
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("US/Eastern")); | |
cal.setTime(date); | |
cal.set(Calendar.MONTH, Calendar.JANUARY); | |
Date timeDate = cal.getTime(); | |
System.out.println(timeDate); | |
} | |
{ | |
Date date = new Date(1325376000000l); | |
Calendar cal = Calendar.getInstance(); | |
cal.setTime(date); | |
cal.set(Calendar.MONTH, Calendar.JANUARY); | |
Date timeDate = cal.getTime(); | |
System.out.println(timeDate); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment