List of usage examples for java.util Calendar DAY_OF_WEEK
int DAY_OF_WEEK
To view the source code for java.util Calendar DAY_OF_WEEK.
Click Source Link
get
and set
indicating the day of the week. From source file:MainClass.java
public static void main(String[] a) { GregorianCalendar calendar = new GregorianCalendar(); calendar.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY); }
From source file:MainClass.java
public static void main(String[] a) { GregorianCalendar calendar = new GregorianCalendar(); calendar.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY); calendar.add(Calendar.YEAR, -14); System.out.println(calendar.get(Calendar.YEAR)); }
From source file:MainClass.java
public static void main(String[] a) { GregorianCalendar calendar = new GregorianCalendar(); calendar.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY); calendar.add(Calendar.YEAR, 14); // 14 years into the future System.out.println(calendar.get(Calendar.YEAR)); }
From source file:MainClass.java
public static void main(String[] a) { GregorianCalendar calendar = new GregorianCalendar(); calendar.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY); int day = calendar.get(Calendar.DAY_OF_WEEK); System.out.println(day);/*from w w w . ja va 2s. com*/ }
From source file:Main.java
public static void main(String[] a) { GregorianCalendar calendar = new GregorianCalendar(); calendar.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY); int day = calendar.get(Calendar.DAY_OF_WEEK); switch (day) { case Calendar.MONDAY: System.out.println(Calendar.MONDAY); break;//w w w .j a va 2s . co m case Calendar.TUESDAY: System.out.println(Calendar.TUESDAY); break; default: System.out.println("others"); } }
From source file:Main.java
public static void main(String[] args) { Calendar cal = Calendar.getInstance(); // return the maximum value for days int max = cal.getMaximum(Calendar.DAY_OF_WEEK); System.out.println("Maximum days :" + max); // return the maximum value for months max = cal.getMaximum(Calendar.MONTH); System.out.println("Maximum months :" + max); }
From source file:Main.java
public static void main(String[] argv) throws Exception { GregorianCalendar newCal = new GregorianCalendar(); int day = newCal.get(Calendar.DAY_OF_WEEK); newCal = new GregorianCalendar(); newCal.set(1997, 2, 1, 0, 0, 0);// w w w . jav a2 s. c o m newCal.setTime(newCal.getTime()); day = newCal.get(Calendar.DAY_OF_WEEK); }
From source file:Main.java
public static void main(String[] args) { Calendar now = Calendar.getInstance(); System.out.println(now.getTime()); int dayOfWeek = now.get(Calendar.DAY_OF_WEEK); if (Calendar.SUNDAY == dayOfWeek) { System.out.println("SUNDAY"); }//from w ww . j av a 2 s . com if (Calendar.MONDAY == dayOfWeek) { System.out.println("MONDAY"); } if (Calendar.TUESDAY == dayOfWeek) { System.out.println("TUESDAY"); } if (Calendar.WEDNESDAY == dayOfWeek) { System.out.println("WEDNESDAY"); } if (Calendar.THURSDAY == dayOfWeek) { System.out.println("THURSDAY"); } if (Calendar.FRIDAY == dayOfWeek) { System.out.println("FRIDAY"); } if (Calendar.SATURDAY == dayOfWeek) { System.out.println("SATURDAY"); } }
From source file:Main.java
public static void main(String[] args) { Calendar now = Calendar.getInstance(); Locale locale = Locale.getDefault(); String n = now.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.ALL_STYLES, locale); System.out.printf(n);//from www . java 2 s. c om }
From source file:Main.java
public static void main(String[] args) { Calendar now = Calendar.getInstance(); Locale locale = Locale.getDefault(); String n = now.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.SHORT, locale); System.out.printf(n);/* w w w. j a v a 2 s . com*/ }