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 boolean IsItTheWeekend() { Calendar calendarToday = Calendar.getInstance(); if (calendarToday.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calendarToday.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { //TODO: //Change back to true, set to false to test information on the weekend return true; } else {//ww w .j a va 2 s . com return false; } }
From source file:Main.java
public static Date getNextSaturday(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date);/*from www. j a v a 2s. co m*/ while (cal.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY) { cal.add(Calendar.DAY_OF_WEEK, 1); } return cal.getTime(); }
From source file:Main.java
public static boolean isFridayOrSaturday() { Calendar date = new GregorianCalendar(); return date.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY || date.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY; }
From source file:Main.java
/** * Get first day of week as android.text.format.Time constant. * * @return the first day of week in android.text.format.Time *//*w ww . ja v a 2 s. com*/ public static int getFirstDayOfWeek(Context context) { int startDay = Calendar.SUNDAY; if (startDay == Calendar.SATURDAY) { return Time.SATURDAY; } else if (startDay == Calendar.MONDAY) { return Time.MONDAY; } else { return Time.SUNDAY; } }
From source file:Main.java
private static boolean isWeekend(Calendar calendar) { int dayOfTheWeek = calendar.get(Calendar.DAY_OF_WEEK); return dayOfTheWeek == Calendar.SATURDAY || dayOfTheWeek == Calendar.SUNDAY; }
From source file:Main.java
public static int getDayOfWeek(Date date, int defSunday) { Calendar c = Calendar.getInstance(); c.setTime(date);// w ww. ja v a 2 s . c o m int day = c.get(Calendar.DAY_OF_WEEK); switch (day) { case Calendar.MONDAY: return 1; case Calendar.TUESDAY: return 2; case Calendar.WEDNESDAY: return 3; case Calendar.THURSDAY: return 4; case Calendar.FRIDAY: return 5; case Calendar.SATURDAY: return 6; case Calendar.SUNDAY: return defSunday; default: return 0; } }
From source file:Main.java
/** * //from ww w. j a va2 s . co m * @return */ public static String ID_DayName() { Calendar cal = Calendar.getInstance(); int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); String weekDayName = ""; if (Calendar.MONDAY == dayOfWeek) { weekDayName = "Senin"; } else if (Calendar.TUESDAY == dayOfWeek) { weekDayName = "Selasa"; } else if (Calendar.WEDNESDAY == dayOfWeek) { weekDayName = "Rabu"; } else if (Calendar.THURSDAY == dayOfWeek) { weekDayName = "Kamis"; } else if (Calendar.FRIDAY == dayOfWeek) { weekDayName = "Jumat"; } else if (Calendar.SATURDAY == dayOfWeek) { weekDayName = "Sabtu"; } else if (Calendar.SUNDAY == dayOfWeek) { weekDayName = "Minggu"; } return weekDayName; }
From source file:Main.java
public static boolean isWeekendDayInCalendar(Calendar calendar) { return calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY; }
From source file:Main.java
/** * Get first day of week as android.text.format.Time constant. * * @return the first day of week in android.text.format.Time *///from w ww . ja v a 2s . co m public static int getFirstDayOfWeek() { int startDay = Calendar.getInstance().getFirstDayOfWeek(); if (startDay == Calendar.SATURDAY) { return Time.SATURDAY; } else if (startDay == Calendar.MONDAY) { return Time.MONDAY; } else { return Time.SUNDAY; } }
From source file:Main.java
public static String getDateString() { String stringDate = ""; Calendar calendar = Calendar.getInstance(); int day = calendar.get(Calendar.DAY_OF_WEEK); int month = calendar.get(Calendar.MONTH); int dayInt = calendar.get(Calendar.DAY_OF_MONTH); switch (day) { case Calendar.SUNDAY: stringDate += "Sunday"; break;/* www .j av a 2 s . c om*/ case Calendar.MONDAY: stringDate += "Monday"; break; case Calendar.TUESDAY: stringDate += "Tuesday"; break; case Calendar.WEDNESDAY: stringDate += "Wednesday"; break; case Calendar.THURSDAY: stringDate += "Thursday"; break; case Calendar.FRIDAY: stringDate += "Friday"; break; case Calendar.SATURDAY: stringDate += "Saturday"; break; } switch (month) { case Calendar.JANUARY: stringDate += ", January"; break; case Calendar.FEBRUARY: stringDate += ", February"; break; case Calendar.MARCH: stringDate += ", March"; break; case Calendar.APRIL: stringDate += ", April"; break; case Calendar.MAY: stringDate += ", May"; break; case Calendar.JUNE: stringDate += ", June"; break; case Calendar.JULY: stringDate += ", July"; break; case Calendar.AUGUST: stringDate += ", August"; break; case Calendar.SEPTEMBER: stringDate += ", September"; break; case Calendar.OCTOBER: stringDate += ", October"; break; case Calendar.NOVEMBER: stringDate += ", November"; break; case Calendar.DECEMBER: stringDate += ", December"; break; } stringDate += (" " + dayInt); return stringDate; }