List of usage examples for java.util GregorianCalendar getTime
public final Date getTime()
Date
object representing this Calendar
's time value (millisecond offset from the Epoch"). From source file:Main.java
public static void main(String[] a) { GregorianCalendar calendar = new GregorianCalendar(); Date now = calendar.getTime(); System.out.println(now);/*from w ww. ja v a 2 s. c om*/ }
From source file:Main.java
public static void main(String[] args) { GregorianCalendar cal = new GregorianCalendar(); System.out.println(cal.getTime()); }
From source file:Main.java
public static void main(String[] args) { GregorianCalendar cal = new GregorianCalendar(2013, 9, 9); System.out.println(cal.getTime()); }
From source file:Main.java
public static void main(String[] args) { GregorianCalendar cal = new GregorianCalendar(Locale.ENGLISH); System.out.println(cal.getTime()); }
From source file:Main.java
public static void main(String[] args) { GregorianCalendar cal = new GregorianCalendar(2013, 9, 9, 22, 23); System.out.println(cal.getTime()); }
From source file:Main.java
public static void main(String[] args) { // Get the current date in the system default time zone GregorianCalendar currentDate = new GregorianCalendar(); System.out.println(currentDate.getTime()); // Get GregorianCalendar object representing March 21, 2014 07:30:45 AM GregorianCalendar someDate = new GregorianCalendar(2014, Calendar.MARCH, 21, 7, 30, 45); System.out.println(someDate.getTime()); // Get Indian time zone, which is GMT+05:30 TimeZone indianTZ = TimeZone.getTimeZone("GMT+05:30"); GregorianCalendar indianDate = new GregorianCalendar(indianTZ); System.out.println(indianDate.getTime()); }
From source file:Main.java
public static void main(String[] args) { GregorianCalendar cal = new GregorianCalendar(TimeZone.getDefault()); System.out.println(cal.getTime()); }
From source file:Main.java
public static void main(String[] args) { GregorianCalendar cal = new GregorianCalendar(2013, 9, 9, 22, 23, 52); System.out.println(cal.getTime()); }
From source file:Main.java
public static void main(String[] args) { GregorianCalendar gc = new GregorianCalendar(); System.out.println("Current Date: " + gc.getTime()); // Add 1 year gc.add(Calendar.YEAR, 1);//from w w w. ja v a 2s . com System.out.println(gc.getTime()); // Add 15 days gc.add(Calendar.DATE, 15); System.out.println(gc.getTime()); }
From source file:Main.java
public static void main(String[] args) { GregorianCalendar gc = new GregorianCalendar(2010, Calendar.SEPTEMBER, 9); Date birthDate = gc.getTime(); String pattern = "'I was born on the day' dd 'of the month 'MMMM 'in' yyyy"; SimpleDateFormat simpleFormatter = new SimpleDateFormat(pattern); System.out.println(simpleFormatter.format(birthDate)); }