Java Code Examples for java.util.Calendar#AUGUST
The following examples show how to use
java.util.Calendar#AUGUST .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleMonthView.java From AppCompat-Extension-Library with Apache License 2.0 | 6 votes |
private static int getDaysInMonth(int month, int year) { switch (month) { case Calendar.JANUARY: case Calendar.MARCH: case Calendar.MAY: case Calendar.JULY: case Calendar.AUGUST: case Calendar.OCTOBER: case Calendar.DECEMBER: return 31; case Calendar.APRIL: case Calendar.JUNE: case Calendar.SEPTEMBER: case Calendar.NOVEMBER: return 30; case Calendar.FEBRUARY: return (year % 4 == 0) ? 29 : 28; default: throw new IllegalArgumentException("Invalid Month"); } }
Example 2
Source File: SUtils.java From SublimePicker with Apache License 2.0 | 6 votes |
public static int getDaysInMonth(int month, int year) { switch (month) { case Calendar.JANUARY: case Calendar.MARCH: case Calendar.MAY: case Calendar.JULY: case Calendar.AUGUST: case Calendar.OCTOBER: case Calendar.DECEMBER: return 31; case Calendar.APRIL: case Calendar.JUNE: case Calendar.SEPTEMBER: case Calendar.NOVEMBER: return 30; case Calendar.FEBRUARY: // This is not correct. See isLeapYear(int) above //return (year % 4 == 0) ? 29 : 28; return isLeapYear(year) ? 29 : 28; default: throw new IllegalArgumentException("Invalid Month"); } }
Example 3
Source File: Utils.java From BottomSheetPickers with Apache License 2.0 | 6 votes |
public static int getDaysInMonth(int month, int year) { switch (month) { case Calendar.JANUARY: case Calendar.MARCH: case Calendar.MAY: case Calendar.JULY: case Calendar.AUGUST: case Calendar.OCTOBER: case Calendar.DECEMBER: return 31; case Calendar.APRIL: case Calendar.JUNE: case Calendar.SEPTEMBER: case Calendar.NOVEMBER: return 30; case Calendar.FEBRUARY: return (year % 4 == 0) ? 29 : 28; default: throw new IllegalArgumentException("Invalid Month"); } }
Example 4
Source File: CalendarUtils.java From AirCalendar with MIT License | 6 votes |
public static int getDaysInMonth(int month, int year) { switch (month) { case Calendar.JANUARY: case Calendar.MARCH: case Calendar.MAY: case Calendar.JULY: case Calendar.AUGUST: case Calendar.OCTOBER: case Calendar.DECEMBER: return 31; case Calendar.APRIL: case Calendar.JUNE: case Calendar.SEPTEMBER: case Calendar.NOVEMBER: return 30; case Calendar.FEBRUARY: return ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) ? 28 : 29; default: throw new IllegalArgumentException("Invalid Month"); } }
Example 5
Source File: Utils.java From cathode with Apache License 2.0 | 6 votes |
public static int getDaysInMonth(int month, int year) { switch (month) { case Calendar.JANUARY: case Calendar.MARCH: case Calendar.MAY: case Calendar.JULY: case Calendar.AUGUST: case Calendar.OCTOBER: case Calendar.DECEMBER: return 31; case Calendar.APRIL: case Calendar.JUNE: case Calendar.SEPTEMBER: case Calendar.NOVEMBER: return 30; case Calendar.FEBRUARY: return (year % 4 == 0) ? 29 : 28; default: throw new IllegalArgumentException("Invalid Month"); } }
Example 6
Source File: CalendarUtils.java From CalendarListview with MIT License | 6 votes |
public static int getDaysInMonth(int month, int year) { switch (month) { case Calendar.JANUARY: case Calendar.MARCH: case Calendar.MAY: case Calendar.JULY: case Calendar.AUGUST: case Calendar.OCTOBER: case Calendar.DECEMBER: return 31; case Calendar.APRIL: case Calendar.JUNE: case Calendar.SEPTEMBER: case Calendar.NOVEMBER: return 30; case Calendar.FEBRUARY: return ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) ? 29 : 28; default: throw new IllegalArgumentException("Invalid Month"); } }
Example 7
Source File: Shark.java From JavaMainRepo with Apache License 2.0 | 5 votes |
@Override public double getPredisposition() throws Exception { Calendar date = GregorianCalendar.getInstance(); if (date.get(Calendar.MONTH) == Calendar.AUGUST) { return 0.15; } else { return 0; } }
Example 8
Source File: TransitionTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public void Test4278609() { SimpleTimeZone tz = new SimpleTimeZone(0, "MyTimeZone", /* DST start day: August, 1, 0:00 */ Calendar.AUGUST, 1, 0, 0, /* DST end day: January, 1, 0:00 (wall-clock)*/ Calendar.JANUARY, 1, 0, 0, 60 * 60 * 1000); Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT")); // setting a date using GMT zone just after the end rule of tz zone cal.clear(); cal.set(Calendar.ERA, GregorianCalendar.AD); cal.set(1998, Calendar.DECEMBER, 31, 23, 01, 00); Date date = cal.getTime(); int millis = cal.get(Calendar.HOUR_OF_DAY) * 3600000 + cal.get(Calendar.MINUTE) * 60000 + cal.get(Calendar.SECOND) * 1000 + cal.get(Calendar.MILLISECOND); /* we must use standard local time */ millis += tz.getRawOffset(); int offset = tz.getOffset(cal.get(Calendar.ERA), cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE), cal.get(Calendar.DAY_OF_WEEK), millis); if (offset != 0) { SimpleDateFormat format = new SimpleDateFormat("dd MMM HH:mm:ss zzz", Locale.US); format.setTimeZone(tz); errln("Wrong DST transition: " + tz + "\na date just after DST = " + format.format(date) + "\ngetOffset = " + offset); } }
Example 9
Source File: HttpDateTime.java From play-apk-expansion with Apache License 2.0 | 5 votes |
private static int getMonth(String monthString) { int hash = Character.toLowerCase(monthString.charAt(0)) + Character.toLowerCase(monthString.charAt(1)) + Character.toLowerCase(monthString.charAt(2)) - 3 * 'a'; switch (hash) { case 22: return Calendar.JANUARY; case 10: return Calendar.FEBRUARY; case 29: return Calendar.MARCH; case 32: return Calendar.APRIL; case 36: return Calendar.MAY; case 42: return Calendar.JUNE; case 40: return Calendar.JULY; case 26: return Calendar.AUGUST; case 37: return Calendar.SEPTEMBER; case 35: return Calendar.OCTOBER; case 48: return Calendar.NOVEMBER; case 9: return Calendar.DECEMBER; default: throw new IllegalArgumentException(); } }
Example 10
Source File: HttpDateTime.java From android-download-manager with Apache License 2.0 | 5 votes |
private static int getMonth(String monthString) { int hash = Character.toLowerCase(monthString.charAt(0)) + Character.toLowerCase(monthString.charAt(1)) + Character.toLowerCase(monthString.charAt(2)) - 3 * 'a'; switch (hash) { case 22: return Calendar.JANUARY; case 10: return Calendar.FEBRUARY; case 29: return Calendar.MARCH; case 32: return Calendar.APRIL; case 36: return Calendar.MAY; case 42: return Calendar.JUNE; case 40: return Calendar.JULY; case 26: return Calendar.AUGUST; case 37: return Calendar.SEPTEMBER; case 35: return Calendar.OCTOBER; case 48: return Calendar.NOVEMBER; case 9: return Calendar.DECEMBER; default: throw new IllegalArgumentException(); } }
Example 11
Source File: UpcomingWeekendsActivity.java From Travel-Mate with MIT License | 5 votes |
private int getMonthByString(String month) { switch (month) { case "January": return Calendar.JANUARY; case "February": return Calendar.FEBRUARY; case "March": return Calendar.MARCH; case "April": return Calendar.APRIL; case "May": return Calendar.MAY; case "June": return Calendar.JUNE; case "July": return Calendar.JULY; case "August": return Calendar.AUGUST; case "September": return Calendar.SEPTEMBER; case "October": return Calendar.OCTOBER; case "November": return Calendar.NOVEMBER; case "December": return Calendar.DECEMBER; } return -1; }
Example 12
Source File: EarthClock.java From mars-sim with GNU General Public License v3.0 | 5 votes |
public String getMonthString() { int w = getMonth(); StringBuilder s = new StringBuilder(); if (w == Calendar.JANUARY) s.append("Jan"); else if (w == Calendar.FEBRUARY) s.append("Feb"); else if (w == Calendar.MARCH) s.append("Mar"); else if (w == Calendar.APRIL) s.append("Apr"); else if (w == Calendar.MAY) s.append("May"); else if (w == Calendar.JUNE) s.append("Jun"); else if (w == Calendar.JULY) s.append("Jul"); else if (w == Calendar.AUGUST) s.append("Aug"); else if (w == Calendar.SEPTEMBER) s.append("Sep"); else if (w == Calendar.OCTOBER) s.append("Oct"); else if (w == Calendar.NOVEMBER) s.append("Nov"); else if (w == Calendar.DECEMBER) s.append("Dec"); return s.toString(); }
Example 13
Source File: HttpDateTime.java From QtAndroidTools with MIT License | 5 votes |
private static int getMonth(String monthString) { int hash = Character.toLowerCase(monthString.charAt(0)) + Character.toLowerCase(monthString.charAt(1)) + Character.toLowerCase(monthString.charAt(2)) - 3 * 'a'; switch (hash) { case 22: return Calendar.JANUARY; case 10: return Calendar.FEBRUARY; case 29: return Calendar.MARCH; case 32: return Calendar.APRIL; case 36: return Calendar.MAY; case 42: return Calendar.JUNE; case 40: return Calendar.JULY; case 26: return Calendar.AUGUST; case 37: return Calendar.SEPTEMBER; case 35: return Calendar.OCTOBER; case 48: return Calendar.NOVEMBER; case 9: return Calendar.DECEMBER; default: throw new IllegalArgumentException(); } }
Example 14
Source File: Shark.java From JavaMainRepo with Apache License 2.0 | 5 votes |
@Override public double getPredisposition() throws Exception { Calendar date = GregorianCalendar.getInstance(); if (date.get(Calendar.MONTH) == Calendar.AUGUST) { return 0.15; } else { return 0; } }
Example 15
Source File: HttpDateTime.java From UnityOBBDownloader with Apache License 2.0 | 5 votes |
private static int getMonth(String monthString) { int hash = Character.toLowerCase(monthString.charAt(0)) + Character.toLowerCase(monthString.charAt(1)) + Character.toLowerCase(monthString.charAt(2)) - 3 * 'a'; switch (hash) { case 22: return Calendar.JANUARY; case 10: return Calendar.FEBRUARY; case 29: return Calendar.MARCH; case 32: return Calendar.APRIL; case 36: return Calendar.MAY; case 42: return Calendar.JUNE; case 40: return Calendar.JULY; case 26: return Calendar.AUGUST; case 37: return Calendar.SEPTEMBER; case 35: return Calendar.OCTOBER; case 48: return Calendar.NOVEMBER; case 9: return Calendar.DECEMBER; default: throw new IllegalArgumentException(); } }
Example 16
Source File: TransitionTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public void Test4278609() { SimpleTimeZone tz = new SimpleTimeZone(0, "MyTimeZone", /* DST start day: August, 1, 0:00 */ Calendar.AUGUST, 1, 0, 0, /* DST end day: January, 1, 0:00 (wall-clock)*/ Calendar.JANUARY, 1, 0, 0, 60 * 60 * 1000); Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT")); // setting a date using GMT zone just after the end rule of tz zone cal.clear(); cal.set(Calendar.ERA, GregorianCalendar.AD); cal.set(1998, Calendar.DECEMBER, 31, 23, 01, 00); Date date = cal.getTime(); int millis = cal.get(Calendar.HOUR_OF_DAY) * 3600000 + cal.get(Calendar.MINUTE) * 60000 + cal.get(Calendar.SECOND) * 1000 + cal.get(Calendar.MILLISECOND); /* we must use standard local time */ millis += tz.getRawOffset(); int offset = tz.getOffset(cal.get(Calendar.ERA), cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE), cal.get(Calendar.DAY_OF_WEEK), millis); if (offset != 0) { SimpleDateFormat format = new SimpleDateFormat("dd MMM HH:mm:ss zzz", Locale.US); format.setTimeZone(tz); errln("Wrong DST transition: " + tz + "\na date just after DST = " + format.format(date) + "\ngetOffset = " + offset); } }
Example 17
Source File: DateTools.java From o2oa with GNU Affero General Public License v3.0 | 4 votes |
public static Date floorSeason(Date date, Integer adjust) throws Exception { Calendar cal = DateUtils.toCalendar(date); switch (cal.get(Calendar.MONTH)) { case Calendar.JANUARY: cal.set(Calendar.MONTH, Calendar.JANUARY); break; case Calendar.FEBRUARY: cal.set(Calendar.MONTH, Calendar.JANUARY); break; case Calendar.MARCH: cal.set(Calendar.MONTH, Calendar.JANUARY); break; case Calendar.APRIL: cal.set(Calendar.MONTH, Calendar.APRIL); break; case Calendar.MAY: cal.set(Calendar.MONTH, Calendar.APRIL); break; case Calendar.JUNE: cal.set(Calendar.MONTH, Calendar.APRIL); break; case Calendar.JULY: cal.set(Calendar.MONTH, Calendar.JULY); break; case Calendar.AUGUST: cal.set(Calendar.MONTH, Calendar.JULY); break; case Calendar.SEPTEMBER: cal.set(Calendar.MONTH, Calendar.JULY); break; case Calendar.OCTOBER: cal.set(Calendar.MONTH, Calendar.OCTOBER); break; case Calendar.NOVEMBER: cal.set(Calendar.MONTH, Calendar.OCTOBER); break; case Calendar.DECEMBER: cal.set(Calendar.MONTH, Calendar.OCTOBER); break; default: } if ((null != adjust) && (adjust != 0)) { cal.add(Calendar.MONTH, (adjust * 3)); } cal.set(Calendar.DAY_OF_MONTH, 1); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTime(); }
Example 18
Source File: MultiCalendarAdapter.java From holo-calendar with Apache License 2.0 | 4 votes |
/** * Get the title for the current position * * @param position - The position in the ViewPager * @return Title: MONTH YEAR -> MARCH 2013 */ @Override public String getTitle(final int position) { final Context context = mContext; final Calendar date = Calendar.getInstance(); date.setTimeInMillis((mCalendarView.getFirstValidDay().getTimeInMillis())); date.add(Calendar.MONTH, position); final String month; switch(date.get(Calendar.MONTH)) { case Calendar.JANUARY: month = context.getString(R.string.lib_month_january); break; case Calendar.FEBRUARY: month = context.getString(R.string.lib_month_february); break; case Calendar.MARCH: month = context.getString(R.string.lib_month_march); break; case Calendar.APRIL: month = context.getString(R.string.lib_month_april); break; case Calendar.MAY: month = context.getString(R.string.lib_month_may); break; case Calendar.JUNE: month = context.getString(R.string.lib_month_june); break; case Calendar.JULY: month = context.getString(R.string.lib_month_july); break; case Calendar.AUGUST: month = context.getString(R.string.lib_month_august); break; case Calendar.SEPTEMBER: month = context.getString(R.string.lib_month_september); break; case Calendar.OCTOBER: month = context.getString(R.string.lib_month_october); break; case Calendar.NOVEMBER: month = context.getString(R.string.lib_month_november); break; default: case Calendar.DECEMBER: month = context.getString(R.string.lib_month_december); break; } return month + " " + date.get(Calendar.YEAR); }
Example 19
Source File: ISO8601DateFormat.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
/** Appends a date in the format "YYYY-mm-dd HH:mm:ss,SSS" to <code>sbuf</code>. For example: "1999-11-27 15:49:37,459". @param sbuf the <code>StringBuffer</code> to write to */ public StringBuffer format(Date date, StringBuffer sbuf, FieldPosition fieldPosition) { long now = date.getTime(); int millis = (int)(now % 1000); if ((now - millis) != lastTime) { // We reach this point at most once per second // across all threads instead of each time format() // is called. This saves considerable CPU time. calendar.setTime(date); int start = sbuf.length(); int year = calendar.get(Calendar.YEAR); sbuf.append(year); String month; switch(calendar.get(Calendar.MONTH)) { case Calendar.JANUARY: month = "-01-"; break; case Calendar.FEBRUARY: month = "-02-"; break; case Calendar.MARCH: month = "-03-"; break; case Calendar.APRIL: month = "-04-"; break; case Calendar.MAY: month = "-05-"; break; case Calendar.JUNE: month = "-06-"; break; case Calendar.JULY: month = "-07-"; break; case Calendar.AUGUST: month = "-08-"; break; case Calendar.SEPTEMBER: month = "-09-"; break; case Calendar.OCTOBER: month = "-10-"; break; case Calendar.NOVEMBER: month = "-11-"; break; case Calendar.DECEMBER: month = "-12-"; break; default: month = "-NA-"; break; } sbuf.append(month); int day = calendar.get(Calendar.DAY_OF_MONTH); if(day < 10) sbuf.append('0'); sbuf.append(day); sbuf.append(' '); int hour = calendar.get(Calendar.HOUR_OF_DAY); if(hour < 10) { sbuf.append('0'); } sbuf.append(hour); sbuf.append(':'); int mins = calendar.get(Calendar.MINUTE); if(mins < 10) { sbuf.append('0'); } sbuf.append(mins); sbuf.append(':'); int secs = calendar.get(Calendar.SECOND); if(secs < 10) { sbuf.append('0'); } sbuf.append(secs); sbuf.append(','); // store the time string for next time to avoid recomputation sbuf.getChars(start, sbuf.length(), lastTimeString, 0); lastTime = now - millis; } else { sbuf.append(lastTimeString); } if (millis < 100) sbuf.append('0'); if (millis < 10) sbuf.append('0'); sbuf.append(millis); return sbuf; }
Example 20
Source File: BudgetConstructionHumanResourcesPayrollInterfaceDaoJdbc.java From kfs with GNU Affero General Public License v3.0 | 4 votes |
/** * * @see org.kuali.kfs.module.bc.batch.dataaccess.BudgetConstructionHumanResourcesPayrollInterfaceDao#buildBudgetConstructionPositonRequestYear(java.lang.Integer) */ public void buildBudgetConstructionPositonRequestYear(Integer requestFiscalYear) { StringBuilder sqlBuilder = new StringBuilder(2500); // we build constants for DB independence. we let the library decide how they should be represented in what is passed to the DB server String defaultRCCd = new String("--"); String orgSeparator = new String("-"); Integer baseFiscalYear = requestFiscalYear-1; GregorianCalendar calendarJuly1 = new GregorianCalendar(baseFiscalYear, Calendar.JULY, 1); GregorianCalendar calendarAugust1 = new GregorianCalendar(baseFiscalYear, Calendar.AUGUST, 1); Date julyFirst = new Date(calendarJuly1.getTimeInMillis()); Date augustFirst = new Date(calendarAugust1.getTimeInMillis()); String academicPositionType = new String("AC"); String academicTenureTrackSalaryPlan = new String("AC1"); sqlBuilder.append("INSERT INTO LD_BCN_POS_T\n"); sqlBuilder.append("(POSITION_NBR, UNIV_FISCAL_YR, POS_EFFDT, POS_EFF_STATUS, POSN_STATUS,\n"); sqlBuilder.append(" BUDGETED_POSN, CONFIDENTIAL_POSN, POS_STD_HRS_DFLT, POS_REG_TEMP, POS_FTE, POS_DESCR, SETID_DEPT, POS_DEPTID,\n"); sqlBuilder.append(" RC_CD, POS_SAL_PLAN_DFLT, POS_GRADE_DFLT, SETID_JOBCODE, JOBCODE, SETID_SALARY,\n"); sqlBuilder.append(" POS_LOCK_USR_ID)\n"); sqlBuilder.append("(SELECT px.POSITION_NBR,\n"); sqlBuilder.append(" ?, px.EFFDT, px.POS_EFF_STATUS,\n"); sqlBuilder.append(" px.POSN_STATUS, px.BUDGETED_POSN, 'N',\n"); sqlBuilder.append(" px.STD_HRS_DEFAULT, px.POS_REG_TEMP, px.POS_FTE, px.DESCR, px.BUSINESS_UNIT,\n"); sqlBuilder.append(" px.DEPTID, COALESCE(org.RC_CD,?),\n"); sqlBuilder.append(" px.POS_SAL_PLAN_DFLT, px.POS_GRADE_DFLT, px.BUSINESS_UNIT, px.JOBCODE,\n"); sqlBuilder.append(" px.BUSINESS_UNIT, ?\n"); sqlBuilder.append(" FROM PS_POSITION_DATA px LEFT OUTER JOIN LD_BCN_ORG_RPTS_T org\n"); sqlBuilder.append(" ON (CONCAT(CONCAT(org.FIN_COA_CD,?),org.ORG_CD) = px.DEPTID)\n"); sqlBuilder.append(" WHERE ((px.EFFDT <= ?) OR ((px.EFFDT = ?) AND (px.POS_SAL_PLAN_DFLT = ?)))\n"); sqlBuilder.append(" AND (NOT EXISTS (SELECT 1\n"); sqlBuilder.append(" FROM LD_BCN_POS_T\n"); sqlBuilder.append(" WHERE (LD_BCN_POS_T.UNIV_FISCAL_YR = ?)\n"); sqlBuilder.append(" AND (px.POSITION_NBR = LD_BCN_POS_T.POSITION_NBR)))\n"); sqlBuilder.append(" AND (NOT EXISTS (SELECT 1\n"); sqlBuilder.append(" FROM PS_POSITION_DATA py\n"); sqlBuilder.append(" WHERE (px.POSITION_NBR = py.POSITION_NBR)\n"); sqlBuilder.append(" AND ((py.EFFDT <= ?) OR ((py.EFFDT = ?) AND (px.POS_SAL_PLAN_DFLT = ?)))\n"); sqlBuilder.append(" AND (px.EFFDT < py.EFFDT)))\n"); sqlBuilder.append(" AND (EXISTS (SELECT 1\n"); sqlBuilder.append(" FROM LD_CSF_TRACKER_T csf\n"); sqlBuilder.append(" WHERE (csf.UNIV_FISCAL_YR = ?)\n"); sqlBuilder.append(" AND (csf.POS_CSF_DELETE_CD = ?)\n"); sqlBuilder.append(" AND (csf.POSITION_NBR = px.POSITION_NBR))))\n"); String sqlString = sqlBuilder.toString(); getSimpleJdbcTemplate().update(sqlString,requestFiscalYear,defaultRCCd,BCConstants.DEFAULT_BUDGET_HEADER_LOCK_IDS,orgSeparator,julyFirst,augustFirst,academicTenureTrackSalaryPlan,requestFiscalYear,julyFirst,augustFirst,academicTenureTrackSalaryPlan,baseFiscalYear,BCConstants.ACTIVE_CSF_DELETE_CODE); // set the things that we'll need for testing but which we don't have enough information to set from the Kuali DB // this code is obviously somewhat arbitrary--it should be replaced with institution-specific algorithms setAcademicDefaultObjectClass(requestFiscalYear); setMonthlyStaffOvertimeEligibleDefaultObjectClass(requestFiscalYear); setMonthlyStaffOvertimeExemptDefaultObjectClass(requestFiscalYear); setBiweeklyStaffDefaultObjectClass(requestFiscalYear); }