Created
September 3, 2013 13:08
-
-
Save Crydust/6423668 to your computer and use it in GitHub Desktop.
instantiate a Calendar including timezone, locale and milliseconds
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.GregorianCalendar; | |
public class CalendarApp { | |
public static void main(String[] args) { | |
// 2013/09/03 11:46:00.000 UTC | |
Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("UTC"), Locale.ENGLISH); | |
cal.set(2013, 8, 3, 11, 46, 0); | |
cal.set(Calendar.MILLISECOND, 0); | |
long epoch = cal.getTimeInMillis(); | |
System.out.printf("cal = %s%n", cal); | |
System.out.printf("epoch = %s%n", epoch); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment