List of usage examples for java.util Calendar getInstance
public static Calendar getInstance()
From source file:Main.java
public static void main(String[] args) { Calendar now = Calendar.getInstance(); System.out.print(now.isWeekDateSupported()); }
From source file:Main.java
public static void main(String[] args) { Calendar old = Calendar.getInstance(); old.set(Calendar.YEAR, 2990); Calendar now = Calendar.getInstance(); System.out.println("Is old before now ? : " + old.before(now)); }
From source file:Main.java
public static void main(String[] args) { Calendar now = Calendar.getInstance(); System.out.println(now.get(Calendar.DATE)); }
From source file:Main.java
public static void main(String[] args) { Calendar now = Calendar.getInstance(); System.out.println((now.get(Calendar.MONTH) + 1)); }
From source file:Main.java
public static void main(String[] args) { Calendar now = Calendar.getInstance(); System.out.print(now.getWeeksInWeekYear()); }
From source file:Main.java
public static void main(String[] args) { Calendar now = Calendar.getInstance(); System.out.println("Current full date time is : " + (now.get(Calendar.MONTH) + 1) + "-" + now.get(Calendar.DATE) + "-" + now.get(Calendar.YEAR) + " " + now.get(Calendar.HOUR_OF_DAY) + ":" + now.get(Calendar.MINUTE) + ":" + now.get(Calendar.SECOND) + "." + now.get(Calendar.MILLISECOND)); }
From source file:Main.java
public static void main(String[] args) { Calendar now = Calendar.getInstance(); System.out.println(now.getTime()); now.setWeekDate(2013, 12, 2);// w ww.j a v a 2 s . co m System.out.println(now.getTime()); }
From source file:Main.java
public static void main(String[] args) { Calendar cal = Calendar.getInstance(); // return a string representation of this calendar. System.out.println(cal.getTime().toString()); }
From source file:Main.java
public static void main(String[] args) { Calendar cal = Calendar.getInstance(); System.out.println("Today : " + cal.getTime()); // Subtract 1 year from the calendar cal.add(Calendar.YEAR, -1);// w w w . jav a2 s .c o m System.out.println("1 year ago: " + cal.getTime()); }
From source file:Main.java
public static void main(String[] args) { Calendar cal = Calendar.getInstance(); System.out.println("Today : " + cal.getTime()); // Substract 1 year from the calendar cal.add(Calendar.YEAR, -1);// w ww.j a va2s .co m System.out.println("1 year ago: " + cal.getTime()); }