List of usage examples for java.util Calendar THURSDAY
int THURSDAY
To view the source code for java.util Calendar THURSDAY.
Click Source Link
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 a va2 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 ww. j a va 2 s. c o m*/ 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
private static Date getNextBus(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date);/*from www .j a v a 2 s .c o m*/ if (cal.get(Calendar.DAY_OF_WEEK) >= Calendar.MONDAY && cal.get(Calendar.DAY_OF_WEEK) <= Calendar.THURSDAY) { if (isBefore(cal, mon_thu[mon_thu.length - 1])) { setTime(cal, findNext(cal, mon_thu)); } else if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.THURSDAY) { setTime(cal, fri[0]); cal.add(Calendar.DAY_OF_YEAR, 1); } else { setTime(cal, mon_thu[0]); cal.add(Calendar.DAY_OF_YEAR, 1); } } else if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY) { if (isBefore(cal, fri[fri.length - 1])) { setTime(cal, findNext(cal, fri)); } else { setTime(cal, mon_thu[0]); cal.add(Calendar.DAY_OF_YEAR, 3); } } else { setTime(cal, mon_thu[0]); cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); } return cal.getTime(); }
From source file:Main.java
/** * /*from w ww. j a v a2s. c o 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 int getDayOfWeek(Date date, int defSunday) { Calendar c = Calendar.getInstance(); c.setTime(date);// w ww . j a va2 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
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;/*from w w w . jav a2s . 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; }
From source file:Main.java
/** * Converts the day of the week from android.text.format.Time to java.util.Calendar *///from ww w . ja va 2s .co m public static int convertDayOfWeekFromTimeToCalendar(int timeDayOfWeek) { switch (timeDayOfWeek) { case Time.MONDAY: return Calendar.MONDAY; case Time.TUESDAY: return Calendar.TUESDAY; case Time.WEDNESDAY: return Calendar.WEDNESDAY; case Time.THURSDAY: return Calendar.THURSDAY; case Time.FRIDAY: return Calendar.FRIDAY; case Time.SATURDAY: return Calendar.SATURDAY; case Time.SUNDAY: return Calendar.SUNDAY; default: throw new IllegalArgumentException("Argument must be between Time.SUNDAY and " + "Time.SATURDAY"); } }
From source file:com.mirth.connect.donkey.model.channel.PollConnectorPropertiesAdvanced.java
public PollConnectorPropertiesAdvanced() { weekly = true;//from ww w. j a v a 2s . c o m inactiveDays = new boolean[8]; inactiveDays[Calendar.SUNDAY] = false; // true means to exclude inactiveDays[Calendar.MONDAY] = false; inactiveDays[Calendar.TUESDAY] = false; inactiveDays[Calendar.WEDNESDAY] = false; inactiveDays[Calendar.THURSDAY] = false; inactiveDays[Calendar.FRIDAY] = false; inactiveDays[Calendar.SATURDAY] = false; dayOfMonth = 1; allDay = true; startingHour = 8; startingMinute = endingMinute = 0; endingHour = 17; }
From source file:TimeUtil.java
public static String dayStringFormat(long msecs) { GregorianCalendar cal = new GregorianCalendar(); cal.setTime(new Date(msecs)); int dow = cal.get(Calendar.DAY_OF_WEEK); switch (dow) { case Calendar.MONDAY: return "Monday"; case Calendar.TUESDAY: return "Tuesday"; case Calendar.WEDNESDAY: return "Wednesday"; case Calendar.THURSDAY: return "Thursday"; case Calendar.FRIDAY: return "Friday"; case Calendar.SATURDAY: return "Saturday"; case Calendar.SUNDAY: return "Sunday"; }/* w ww . ja va 2 s. co m*/ return "Unknown"; }
From source file:org.exoplatform.addons.sdpDemo.populator.services.Utils.java
/** * Gets the day as int.//www .j a v a 2 s . co m * * @param day the day * @return the day as int */ public static int getDayAsInt(String day) { if ("monday".equals(day)) return Calendar.MONDAY; else if ("tuesday".equals(day)) return Calendar.TUESDAY; else if ("wednesday".equals(day)) return Calendar.WEDNESDAY; else if ("thursday".equals(day)) return Calendar.THURSDAY; else if ("friday".equals(day)) return Calendar.FRIDAY; else if ("saturday".equals(day)) return Calendar.SATURDAY; else if ("sunday".equals(day)) return Calendar.SUNDAY; return Calendar.MONDAY; }