List of usage examples for java.util Calendar set
public void set(int field, int value)
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:MainClass.java
public static void main(String[] args) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.MONTH, Calendar.DECEMBER); }
From source file:Main.java
public static void main(String[] argv) throws Exception { int year = 2004; Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); }
From source file:Main.java
public static void main(String[] args) { int dayOfYear = 112; Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.DAY_OF_YEAR, dayOfYear); System.out.println("Day of year " + dayOfYear + " = " + calendar.getTime()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { // Create a Calendar object with the local time zone Calendar local = new GregorianCalendar(); local.set(Calendar.HOUR_OF_DAY, 10); // 0..23 local.set(Calendar.MINUTE, 0); local.set(Calendar.SECOND, 0); }
From source file:Today.java
public static void main(String[] args) { Calendar cal = Calendar.getInstance(); cal.set(HOUR_OF_DAY, 0); cal.set(MINUTE, 0);// w w w. j av a2 s . c o m cal.set(SECOND, 0); cal.set(MILLISECOND, 0); System.out.println(cal.getTime()); }
From source file:Main.java
public static void main(String[] args) { Calendar future = Calendar.getInstance(); future.set(Calendar.YEAR, 3010); Calendar now = Calendar.getInstance(); System.out.println("Is futureCal after now ? : " + future.after(now)); }
From source file:Main.java
public static void main(String[] args) { Date d1 = Calendar.getInstance().getTime(); Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, 2000); Date d2 = cal.getTime();//from www. j av a2s . c o m System.out.println("First Date : " + d1); System.out.println("Second Date : " + d2); System.out.println("Is second date after first ? : " + d2.after(d1)); }
From source file:Main.java
public static void main(String[] args) { Calendar futureCal = Calendar.getInstance(); futureCal.set(Calendar.YEAR, 3000); Calendar now = Calendar.getInstance(); System.out.println("Current date : " + (now.get(Calendar.MONTH) + 1) + "-" + now.get(Calendar.DATE) + "-" + now.get(Calendar.YEAR)); System.out.println("Is futureCal after now ? : " + futureCal.after(now)); }
From source file:Main.java
public static void main(String[] args) { Date myDate;//from w w w . j a v a 2s .c o m Calendar cal = Calendar.getInstance(); cal.set(Calendar.MONTH, 9); cal.set(Calendar.DATE, 24); cal.set(Calendar.YEAR, 2013); cal.set(Calendar.HOUR, 13); cal.set(Calendar.MINUTE, 45); cal.set(Calendar.SECOND, 52); myDate = cal.getTime(); System.out.println(myDate); }