Java Code Examples for java.util.Calendar#SEPTEMBER
The following examples show how to use
java.util.Calendar#SEPTEMBER .
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: 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 2
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 3
Source File: Utils.java From DateTimepicker 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 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 5
Source File: DateUtils.java From CustomizableCalendar 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) ? 29 : 28; default: throw new IllegalArgumentException("Invalid Month"); } }
Example 6
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 7
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 8
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 9
Source File: HttpDateTime.java From Alite with GNU General Public License v3.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: ReportServiceTest.java From restful-booker-platform with GNU General Public License v3.0 | 5 votes |
@Before public void initialiseMocks() { MockitoAnnotations.initMocks(this); Room roomOne = new Room(1, 101, "Single", 1, true, "Wifi"); Room roomTwo = new Room(2, 102, "Double", 2, true, "Mini-bar"); Rooms sampleRooms = new Rooms(new ArrayList<Room>(){{ this.add(roomOne); this.add(roomTwo); }}); Calendar startDate = new GregorianCalendar(2019, Calendar.SEPTEMBER, 1); Calendar endDate = new GregorianCalendar(2019, Calendar.SEPTEMBER, 2); BookingDates bookingDates = new BookingDates(startDate.getTime(), endDate.getTime()); Booking bookingOne = new Booking(1, 1, "Mark", "Dean", true, bookingDates); Booking bookingTwo = new Booking(2, 2, "James", "Jones", true, bookingDates); Bookings bookingsOne = new Bookings(new ArrayList<Booking>(){{ this.add(bookingOne); }}); Bookings bookingsTwo = new Bookings(new ArrayList<Booking>(){{ this.add(bookingTwo); }}); when(roomRequests.searchForRooms()).thenReturn(sampleRooms); when(bookingRequests.getBookings(1)).thenReturn(bookingsOne); when(bookingRequests.getBookings(2)).thenReturn(bookingsTwo); }
Example 11
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 12
Source File: HttpDateTime.java From travelguide 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 13
Source File: DateFormatter.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
private boolean tryParseMonth(CharSequence txt, int tokenStart, int tokenEnd) { int len = tokenEnd - tokenStart; if (len != 3) { return false; } if (matchMonth("Jan", txt, tokenStart)) { month = Calendar.JANUARY; } else if (matchMonth("Feb", txt, tokenStart)) { month = Calendar.FEBRUARY; } else if (matchMonth("Mar", txt, tokenStart)) { month = Calendar.MARCH; } else if (matchMonth("Apr", txt, tokenStart)) { month = Calendar.APRIL; } else if (matchMonth("May", txt, tokenStart)) { month = Calendar.MAY; } else if (matchMonth("Jun", txt, tokenStart)) { month = Calendar.JUNE; } else if (matchMonth("Jul", txt, tokenStart)) { month = Calendar.JULY; } else if (matchMonth("Aug", txt, tokenStart)) { month = Calendar.AUGUST; } else if (matchMonth("Sep", txt, tokenStart)) { month = Calendar.SEPTEMBER; } else if (matchMonth("Oct", txt, tokenStart)) { month = Calendar.OCTOBER; } else if (matchMonth("Nov", txt, tokenStart)) { month = Calendar.NOVEMBER; } else if (matchMonth("Dec", txt, tokenStart)) { month = Calendar.DECEMBER; } else { return false; } return true; }
Example 14
Source File: DateTools.java From o2oa with GNU Affero General Public License v3.0 | 4 votes |
public static Date ceilSeason(Date date, Integer adjust) throws Exception { Calendar cal = DateUtils.toCalendar(date); switch (cal.get(Calendar.MONTH)) { case Calendar.JANUARY: cal.set(Calendar.MONTH, Calendar.MARCH); break; case Calendar.FEBRUARY: cal.set(Calendar.MONTH, Calendar.MARCH); break; case Calendar.MARCH: cal.set(Calendar.MONTH, Calendar.MARCH); break; case Calendar.APRIL: cal.set(Calendar.MONTH, Calendar.JUNE); break; case Calendar.MAY: cal.set(Calendar.MONTH, Calendar.JUNE); break; case Calendar.JUNE: cal.set(Calendar.MONTH, Calendar.JUNE); break; case Calendar.JULY: cal.set(Calendar.MONTH, Calendar.SEPTEMBER); break; case Calendar.AUGUST: cal.set(Calendar.MONTH, Calendar.SEPTEMBER); break; case Calendar.SEPTEMBER: cal.set(Calendar.MONTH, Calendar.SEPTEMBER); break; case Calendar.OCTOBER: cal.set(Calendar.MONTH, Calendar.DECEMBER); break; case Calendar.NOVEMBER: cal.set(Calendar.MONTH, Calendar.DECEMBER); break; case Calendar.DECEMBER: cal.set(Calendar.MONTH, Calendar.DECEMBER); break; default: } if ((null != adjust) && (adjust != 0)) { cal.add(Calendar.MONTH, (adjust * 3)); } return DateUtils.ceiling(cal, Calendar.MONTH).getTime(); }
Example 15
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 16
Source File: TimeConstraint.java From hawkular-alerts with Apache License 2.0 | 4 votes |
private int month(String sMonth) { if (isEmpty(sMonth)) { return -1; } if (sMonth.length() < 3) { return -1; } String prefix = sMonth.substring(0, 3).toLowerCase(); MONTH m = MONTH.fromString(prefix); if (m == null) { return -1; } switch (m) { 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; default: return -1; } }
Example 17
Source File: monthConverter.java From openbd-core with GNU General Public License v3.0 | 4 votes |
/** * takes a month and returns the index of it - JAN => 1, FEB => 2... * assumes byte[] is in lower case * returns -1 if an invalid month. */ public static int convertMonthToInt(char[] month){ switch (month[0]){ case 'j': if (equivalent(month, "january")){ return Calendar.JANUARY; } else if (equivalent(month, "june")){ return Calendar.JUNE; } else if (equivalent(month, "july")){ return Calendar.JULY; } else return -1; case 'M': case 'm': if (equivalent(month, "may")){ return Calendar.MAY; } else if (equivalent(month, "march")){ return Calendar.MARCH; } else return -1; case 'A': case 'a': if (equivalent(month, "april")){ return Calendar.APRIL; } else if (equivalent(month, "august")){ return Calendar.AUGUST; } else return -1; case 'F': case 'f': if (equivalent(month, "february")){ return Calendar.FEBRUARY; } else return -1; case 'D': case 'd': if (equivalent(month, "december")){ return Calendar.DECEMBER; } else return -1; case 'S': case 's': if (equivalent(month, "september")){ return Calendar.SEPTEMBER; } else return -1; case 'O': case 'o': if (equivalent(month, "october")){ return Calendar.OCTOBER; } else return -1; case 'N': case 'n': if (equivalent(month, "november")){ return Calendar.NOVEMBER; } else return -1; default: return -1; }//switch }
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: PanchangExporter.java From Astrosoft with GNU General Public License v2.0 | 3 votes |
public static void main(String[] args) { PanchangList pl = new PanchangList(2007,Calendar.SEPTEMBER); String file = "c:/astrosoft/resources/export/panchang.xml"; PanchangExporter pe = new PanchangExporter(file); pe.export2Xml(pl); FOPTransformer.exportToPDF(file, "C:/AstroSoft/resources/export/panchang2pdf.xsl", "C:/AstroSoft/resources/export/panchang.pdf"); }