List of usage examples for java.util Calendar OCTOBER
int OCTOBER
To view the source code for java.util Calendar OCTOBER.
Click Source Link
From source file:Main.java
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://from w w w. j a v a 2 s. com throw new IllegalArgumentException("Invalid Month"); } }
From source file:Main.java
public static int getMonth(String str) { if (str.equals("jan")) return Calendar.JANUARY; if (str.equals("feb")) return Calendar.FEBRUARY; if (str.equals("mar")) return Calendar.MARCH; if (str.equals("apr")) return Calendar.APRIL; if (str.equals("may")) return Calendar.MAY; if (str.equals("jun")) return Calendar.JUNE; if (str.equals("jul")) return Calendar.JULY; if (str.equals("aug")) return Calendar.AUGUST; if (str.equals("sep")) return Calendar.SEPTEMBER; if (str.equals("oct")) return Calendar.OCTOBER; if (str.equals("nov")) return Calendar.NOVEMBER; if (str.equals("dec")) return Calendar.DECEMBER; return -1;//from w ww .j a v a2 s . com }
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 a v a 2 s .c o m 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:one.TimeLineChart.java
public static IntervalCategoryDataset createDataset() { final TaskSeries s1 = new TaskSeries("Scheduled"); int i = 0;/* w ww .ja v a2 s . c o m*/ for (Map.Entry<Date, String> pairs : TimeLineChart.hm.entrySet()) { time[i] = (Date) pairs.getKey(); task[i] = (String) pairs.getValue(); s1.add(new Task(task[i], new SimpleTimePeriod(date(14, Calendar.OCTOBER, 2014), time[i]))); i = i + 1; } System.out.println(task[1]); s1.add(new Task(task[1], new SimpleTimePeriod(date(14, Calendar.OCTOBER, 2014), time[1]))); s1.add(new Task("Database set up", new SimpleTimePeriod(date(15, Calendar.OCTOBER, 2014), date(30, Calendar.OCTOBER, 2014)))); //} // s1.add(new Task("Obtain Approval", // new SimpleTimePeriod(date(9, Calendar.APRIL, 2001), // date(9, Calendar.APRIL, 2001)))); // s1.add(new Task("Requirements Analysis", // new SimpleTimePeriod(date(10, Calendar.APRIL, 2001), // date(5, Calendar.MAY, 2001)))); // s1.add(new Task("Design Phase", // new SimpleTimePeriod(date(6, Calendar.MAY, 2001), // date(30, Calendar.MAY, 2001)))); // s1.add(new Task("Design Signoff", // new SimpleTimePeriod(date(2, Calendar.JUNE, 2001), // date(2, Calendar.JUNE, 2001)))); // s1.add(new Task("Alpha Implementation", // new SimpleTimePeriod(date(3, Calendar.JUNE, 2001), // date(31, Calendar.JULY, 2001)))); // s1.add(new Task("Design Review", // new SimpleTimePeriod(date(1, Calendar.AUGUST, 2001), // date(8, Calendar.AUGUST, 2001)))); // s1.add(new Task("Revised Design Signoff", // new SimpleTimePeriod(date(10, Calendar.AUGUST, 2001), // date(10, Calendar.AUGUST, 2001)))); // s1.add(new Task("Beta Implementation", // new SimpleTimePeriod(date(12, Calendar.AUGUST, 2001), // date(12, Calendar.SEPTEMBER, 2001)))); // s1.add(new Task("Testing", // new SimpleTimePeriod(date(13, Calendar.SEPTEMBER, 2001), // date(31, Calendar.OCTOBER, 2001)))); // s1.add(new Task("Final Implementation", // new SimpleTimePeriod(date(1, Calendar.NOVEMBER, 2001), // date(15, Calendar.NOVEMBER, 2001)))); // s1.add(new Task("Signoff", // new SimpleTimePeriod(date(28, Calendar.NOVEMBER, 2001), // date(30, Calendar.NOVEMBER, 2001)))); final TaskSeriesCollection collection = new TaskSeriesCollection(); collection.add(s1); return collection; }
From source file:one.TimeLinePanel.java
public static IntervalCategoryDataset createDataset() { final TaskSeries s1 = new TaskSeries("Scheduled"); int i = 0;/*from w w w . j a va 2s.c o m*/ for (Map.Entry<Date, String> pairs : TimeLinePanel.hm.entrySet()) { time[i] = (Date) pairs.getKey(); task[i] = (String) pairs.getValue(); s1.add(new Task(task[i], new SimpleTimePeriod(date(14, Calendar.OCTOBER, 2014), time[i]))); i = i + 1; } System.out.println(task[1]); s1.add(new Task(task[1], new SimpleTimePeriod(date(14, Calendar.OCTOBER, 2014), time[1]))); s1.add(new Task("Database set up", new SimpleTimePeriod(date(15, Calendar.OCTOBER, 2014), date(30, Calendar.OCTOBER, 2014)))); final TaskSeriesCollection collection = new TaskSeriesCollection(); collection.add(s1); return collection; }
From source file:srvmonitor.thGetAgendas.java
@Override public void run() { /*/*from w ww. j a va 2s .c o m*/ Recupera Parametros Fecha Actual */ logger.info("Buscando Agendas Activas"); String[] ids = TimeZone.getAvailableIDs(-4 * 60 * 60 * 1000); String clt = ids[0]; SimpleTimeZone tz = new SimpleTimeZone(-4 * 60 * 60 * 1000, clt); tz.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000); tz.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000); Calendar calendar = new GregorianCalendar(tz); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH); // Jan = 0, dec = 11 int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH); int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); int weekOfYear = calendar.get(Calendar.WEEK_OF_YEAR); int weekOfMonth = calendar.get(Calendar.WEEK_OF_MONTH); int hour = calendar.get(Calendar.HOUR); // 12 hour clock int hourOfDay = calendar.get(Calendar.HOUR_OF_DAY); // 24 hour clock int minute = calendar.get(Calendar.MINUTE); int second = calendar.get(Calendar.SECOND); int millisecond = calendar.get(Calendar.MILLISECOND); int findHour = 12; int findMinutes = 5; /* calendar.add(Calendar.HOUR_OF_DAY, -1); int hourBefore = calendar.get(Calendar.HOUR_OF_DAY); calendar.add(Calendar.HOUR_OF_DAY, 2); int hourAfter = calendar.get(Calendar.HOUR_OF_DAY); */ String posmonth = String.valueOf(month + 1); String posdayOfMonth = String.valueOf(dayOfMonth); String posdayOfWeek = String.valueOf(dayOfWeek); String posweekOfYear = String.valueOf(weekOfYear); String posweekOfMonth = String.valueOf(weekOfMonth); String poshourOfDay = String.valueOf(hourOfDay); String posminute = String.valueOf(minute); String possecond = String.valueOf(second); String posmillisecond = String.valueOf(millisecond); Calendar iteratorCalendar; String vSQL; String iteratorHour; String iteratorMinute; Statement stm; JSONObject jData; JSONObject jDataMinute; JSONArray jArray = new JSONArray(); JSONArray jArrayMinute = new JSONArray(); String posIteratorHour; String posIteratorMinute; /* Inicializa Lista de Agendas */ gDatos.getLstShowAgendas().clear(); gDatos.getLstActiveAgendas().clear(); for (int i = -findHour; i <= findHour; i++) { iteratorCalendar = new GregorianCalendar(tz); iteratorCalendar.add(Calendar.HOUR_OF_DAY, i); iteratorHour = String.valueOf(iteratorCalendar.get(Calendar.HOUR_OF_DAY)); posIteratorHour = String.valueOf(Integer.valueOf(iteratorHour) + 1); vSQL = "select " + iteratorHour + " horaAgenda,ageID, month, dayOfMonth, dayOfWeek, weekOfYear, weekOfMonth, hourOfDay from process.tb_agenda where " + " ageEnable=1 " + " and substr(month," + posmonth + ",1) = '1'" + " and substr(dayOfMonth," + posdayOfMonth + ",1) = '1'" + " and substr(dayOfWeek," + posdayOfWeek + ",1) = '1'" + " and substr(weekOfYear," + posweekOfYear + ",1) = '1'" + " and substr(weekOfMonth," + posweekOfMonth + ",1) = '1'" + " and substr(hourOfDay," + posIteratorHour + ",1) = '1'"; logger.debug("i: " + i + " vSQL: " + vSQL); try { stm = gDatos.getServerStatus().getMetadataConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); jData = new JSONObject(); ResultSet rs = stm.executeQuery(vSQL); if (rs != null) { while (rs.next()) { jData = new JSONObject(); jData.put("horaAgenda", rs.getString("horaAgenda")); jData.put("ageID", rs.getString("ageID")); jData.put("month", rs.getString("month")); jData.put("dayOfMonth", rs.getString("dayOfMonth")); jData.put("weekOfYear", rs.getString("weekOfYear")); jData.put("weekOfMonth", rs.getString("weekOfMonth")); jData.put("hourOfDay", rs.getString("hourOfDay")); jArray.put(jData); gDatos.getLstShowAgendas().add(jData); } } else { jData.put("horaAgenda", iteratorHour); jData.put("ageID", ""); jData.put("month", ""); jData.put("dayOfMonth", ""); jData.put("weekOfYear", ""); jData.put("weekOfMonth", ""); jData.put("hourOfDay", ""); jArray.put(jData); gDatos.getLstShowAgendas().add(jData); System.out.println("No hay registros"); } stm.close(); } catch (SQLException | JSONException e) { logger.error(e.getMessage()); } } iteratorCalendar = new GregorianCalendar(tz); iteratorHour = String.valueOf(iteratorCalendar.get(Calendar.HOUR_OF_DAY)); posIteratorHour = String.valueOf(Integer.valueOf(iteratorHour) + 1); for (int i = -findMinutes; i <= 0; i++) { iteratorCalendar = new GregorianCalendar(tz); iteratorCalendar.add(Calendar.MINUTE, i); iteratorMinute = String.valueOf(iteratorCalendar.get(Calendar.MINUTE)); posIteratorMinute = String.valueOf(Integer.valueOf(iteratorMinute) + 1); vSQL = "select " + iteratorMinute + " horaAgenda,ageID, month, dayOfMonth, dayOfWeek, weekOfYear, weekOfMonth, hourOfDay from process.tb_agenda where " + " ageEnable=1 " + " and substr(month," + posmonth + ",1) = '1'" + " and substr(dayOfMonth," + posdayOfMonth + ",1) = '1'" + " and substr(dayOfWeek," + posdayOfWeek + ",1) = '1'" + " and substr(weekOfYear," + posweekOfYear + ",1) = '1'" + " and substr(weekOfMonth," + posweekOfMonth + ",1) = '1'" + " and substr(hourOfDay," + posIteratorHour + ",1) = '1'" + " and substr(minute," + posIteratorMinute + ",1) = '1'"; logger.debug("i: " + i + " vSQL: " + vSQL); try { stm = gDatos.getServerStatus().getMetadataConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); ResultSet rs = stm.executeQuery(vSQL); if (rs != null) { while (rs.next()) { jDataMinute = new JSONObject(); jDataMinute.put("horaAgenda", rs.getString("horaAgenda")); jDataMinute.put("ageID", rs.getString("ageID")); jDataMinute.put("month", rs.getString("month")); jDataMinute.put("dayOfMonth", rs.getString("dayOfMonth")); jDataMinute.put("weekOfYear", rs.getString("weekOfYear")); jDataMinute.put("weekOfMonth", rs.getString("weekOfMonth")); jDataMinute.put("hourOfDay", rs.getString("hourOfDay")); jArrayMinute.put(jDataMinute); gDatos.getLstActiveAgendas().add(jDataMinute); } } stm.close(); } catch (SQLException | JSONException e) { logger.error(e.getMessage()); } } for (int i = 0; i < gDatos.getLstShowAgendas().size(); i++) { logger.debug(gDatos.getLstShowAgendas().get(i).toString()); } for (int i = 0; i < gDatos.getLstActiveAgendas().size(); i++) { logger.debug(gDatos.getLstActiveAgendas().get(i).toString()); } logger.info("Finaliza busquenda agendas activas..."); }
From source file:ch.cyberduck.core.ftp.parser.RumpusFTPEntryParserTest.java
@Test public void testParse() throws Exception { FTPFile parsed;//from w w w. j ava2s . co m parsed = parser.parseFTPEntry("drwxr-xr-x folder 0 Oct 18 13:02 Akrilik"); assertNotNull(parsed); assertEquals("Akrilik", parsed.getName()); assertEquals(FTPFile.DIRECTORY_TYPE, parsed.getType()); assertEquals(Calendar.OCTOBER, parsed.getTimestamp().get(Calendar.MONTH)); assertEquals(18, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH)); assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.READ_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.READ_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.READ_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.WRITE_PERMISSION)); assertFalse(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.WRITE_PERMISSION)); assertFalse(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.WRITE_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.EXECUTE_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.EXECUTE_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.EXECUTE_PERMISSION)); parsed = parser.parseFTPEntry("drwxrwxrwx folder 0 Oct 11 14:53 Uploads"); assertNotNull(parsed); assertEquals("Uploads", parsed.getName()); assertEquals(FTPFile.DIRECTORY_TYPE, parsed.getType()); assertEquals(Calendar.OCTOBER, parsed.getTimestamp().get(Calendar.MONTH)); assertEquals(11, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH)); assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.READ_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.READ_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.READ_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.WRITE_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.WRITE_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.WRITE_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.EXECUTE_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.EXECUTE_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.EXECUTE_PERMISSION)); parsed = parser.parseFTPEntry("-rw-r--r-- 0 589878 589878 Oct 15 13:03 WebDAV SS.bmp"); assertNotNull(parsed); assertEquals("WebDAV SS.bmp", parsed.getName()); assertEquals(FTPFile.FILE_TYPE, parsed.getType()); assertEquals(Calendar.OCTOBER, parsed.getTimestamp().get(Calendar.MONTH)); assertEquals(15, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH)); assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.READ_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.READ_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.READ_PERMISSION)); assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.WRITE_PERMISSION)); assertFalse(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.WRITE_PERMISSION)); assertFalse(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.WRITE_PERMISSION)); assertFalse(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.EXECUTE_PERMISSION)); assertFalse(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.EXECUTE_PERMISSION)); assertFalse(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.EXECUTE_PERMISSION)); }
From source file:net.sf.sze.service.impl.common.SchulKalenderServiceImpl.java
/** * {@inheritDoc}/*from ww w . j a v a 2 s .c om*/ */ @Override public Calendar getLeavedSchoolDate(final Calendar currentDate) { final Calendar result = Calendar.getInstance(); if (currentDate.get(Calendar.MONTH) >= Calendar.APRIL && currentDate.get(Calendar.MONTH) < Calendar.OCTOBER) { result.set(currentDate.get(Calendar.YEAR), Calendar.FEBRUARY, 1, 0, 0, 0); } else if (currentDate.get(Calendar.MONTH) < Calendar.APRIL) { result.set(currentDate.get(Calendar.YEAR) - 1, Calendar.AUGUST, 1, 0, 0, 0); } else { result.set(currentDate.get(Calendar.YEAR), Calendar.AUGUST, 1, 0, 0, 0); } result.set(Calendar.MILLISECOND, 0); return result; }
From source file:ru.retbansk.utils.scheduled.impl.ReadEmailAndConvertToXmlSpringImplTest.java
@BeforeClass public static void beforeClass() { reader = new ReadEmailAndConvertToXmlSpringImpl(); try {// w w w . j av a2s . c om UsefulMethods.populate(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } DayReport dayReport = new DayReport(); dayReport.setPersonId(USER2); Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT+3")); calendar.set(2012, Calendar.OCTOBER, 18); dayReport.setCalendar(calendar); List<TaskReport> taskList = new ArrayList<TaskReport>(); TaskReport taskReport = new TaskReport(); taskReport.setDate(calendar.getTime()); taskReport.setElapsedTime(1); taskReport.setStatus(TEST_STRING); taskReport.setWorkDescription(TEST_STRING2); taskList.add(taskReport); dayReport.setReportList(taskList); dayReportSet = new HashSet<DayReport>(); dayReportSet.add(dayReport); }
From source file:net.sourceforge.vulcan.core.support.AxisLabelGeneratorTest.java
@Override protected void setUp() throws Exception { super.setUp(); cal.set(Calendar.MONTH, Calendar.OCTOBER); fakeDateFormats.put("en_US:axis.by.month", "MMM yyyy"); fakeDateFormats.put("en_US:axis.by.week", "MMM d"); fakeDateFormats.put("en_US:axis.by.day", "EEE MMM d"); }