List of usage examples for java.util Calendar SATURDAY
int SATURDAY
To view the source code for java.util Calendar SATURDAY.
Click Source Link
From source file:Main.java
public static void main(String[] args) { Calendar calendar = Calendar.getInstance(); // 15-04-2012 calendar.set(Calendar.DAY_OF_MONTH, 15); calendar.set(Calendar.YEAR, 2012); calendar.set(Calendar.HOUR, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MONTH, 3); Date start = calendar.getTime(); // 15-06-2012 calendar.set(Calendar.MONTH, 5); Date end = calendar.getTime(); calendar.setTime(start);//w w w.j av a2 s.c o m Date d = null; while ((d = calendar.getTime()).before(end) || d.equals(end)) { int day = calendar.get(Calendar.DAY_OF_WEEK); if (day != Calendar.SATURDAY && day != Calendar.SUNDAY) { System.out.println(d); } calendar.add(Calendar.DAY_OF_MONTH, 1); } }
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 w w. j av a2 s . c o m 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:MainClass.java
public static void main(String args[]) { Calendar cal = Calendar.getInstance(); Date now = new Date(); cal.setTime(now);//from w w w .ja va 2 s . com int dayofweek = cal.get(Calendar.DAY_OF_WEEK); if (dayofweek == Calendar.SUNDAY) System.out.println("SUNDAY"); if (dayofweek == Calendar.MONDAY) System.out.println("MONDAY"); if (dayofweek == Calendar.TUESDAY) System.out.println("TUESDAY"); if (dayofweek == Calendar.WEDNESDAY) System.out.println("WEDNESDAY"); if (dayofweek == Calendar.THURSDAY) System.out.println("THURSDAY"); if (dayofweek == Calendar.FRIDAY) System.out.println("FRIDAY"); if (dayofweek == Calendar.SATURDAY) { System.out.println("SATURDAY"); } }
From source file:Main.java
public static boolean isSaturday(Calendar c) { return c.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY; }
From source file:Main.java
public static boolean isWeekend() { Calendar now = Calendar.getInstance(); return (now.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) || (now.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY); }
From source file:Main.java
public static boolean isThisWeek(int dateToCheck) { int dayOfWeek = getCurrentDay(); if (dayOfWeek == Calendar.SATURDAY) { return dayOfWeek > dateToCheck; } else {/*from w w w. j a va2s .co m*/ return dayOfWeek < dateToCheck; } }
From source file:Main.java
public static boolean isNextWeek(int dateToCheck) { int dayOfWeek = getCurrentDay(); if (dayOfWeek == Calendar.SATURDAY) { return dayOfWeek <= dateToCheck; } else {//from ww w .ja v a 2 s . co m return dayOfWeek >= dateToCheck; } }
From source file:Main.java
public static boolean isHoliday(Calendar c) { final int week = c.get(Calendar.DAY_OF_WEEK); return week == Calendar.SUNDAY || week == Calendar.SATURDAY; }
From source file:Main.java
public static Date saturday() { return weekDay(Calendar.SATURDAY); }
From source file:Main.java
public static int getServiceIdForDay(int day) { switch (day) { case Calendar.SUNDAY: { return 3; }// w w w. j a v a 2 s. c om case Calendar.SATURDAY: { return 2; } default: { // this will cover any days not specifically called out return 1; } } }