List of usage examples for java.util Calendar MONDAY
int MONDAY
To view the source code for java.util Calendar MONDAY.
Click Source Link
From source file:Main.java
public static void main(String args[]) { SimpleTimeZone stobj = new SimpleTimeZone(-28800000, "India", Calendar.MAY, 1, -Calendar.SUNDAY, 7200000, Calendar.OCTOBER, -1, Calendar.MONDAY, 7200000, 3600000); // setting DST saving time stobj.setDSTSavings(5400000);// w w w . j a v a 2 s. c om // checking the value System.out.println("DST saving value : " + stobj.getDSTSavings()); }
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;/*ww w .j av a 2 s . c o 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 now = Calendar.getInstance(); System.out.println(now.getTime()); int dayOfWeek = now.get(Calendar.DAY_OF_WEEK); if (Calendar.SUNDAY == dayOfWeek) { System.out.println("SUNDAY"); }/* w ww . j a va2s . 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 www . j a v a 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
public static Calendar getMonday(Calendar calendar) { while (calendar.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) { calendar.add(Calendar.DATE, -1); }/*from w ww. j ava 2 s . c om*/ return calendar; }
From source file:Main.java
public static Calendar getFirstDayOfWeek() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0);/*from w ww. ja v a2s . c om*/ cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal; }
From source file:Main.java
private static void prepareCalendarStartsMonday(Calendar calendar) { if (calendar.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) { int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); if (dayOfWeek == Calendar.SUNDAY) { calendar.add(Calendar.DATE, -6); } else {/*from ww w . j ava 2s . com*/ calendar.add(Calendar.DATE, -dayOfWeek + 2); } } }
From source file:Main.java
public static Calendar nextMonday() { Calendar date = new GregorianCalendar(); while (date.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) { date.add(Calendar.DATE, 1); }/* ww w .j a v a 2 s.c o m*/ date.set(Calendar.HOUR_OF_DAY, 0); date.set(Calendar.MINUTE, 0); date.set(Calendar.SECOND, 0); date.set(Calendar.MILLISECOND, 0); return date; }
From source file:DateUtils.java
public static Date getLastWeek() { GregorianCalendar dayBeforeThisWeek = new GregorianCalendar(); int dayFromMonday = (dayBeforeThisWeek.get(Calendar.DAY_OF_WEEK) + 7 - Calendar.MONDAY) % 7; dayBeforeThisWeek.add(Calendar.DATE, -dayFromMonday - 1); return dayBeforeThisWeek.getTime(); }
From source file:Main.java
public static Date getNextMonday(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date);//from w w w.j ava 2 s. c o m while (cal.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) { cal.add(Calendar.DAY_OF_WEEK, 1); } return cal.getTime(); }