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:simpleserver.bot.BotController.java
public void ready() { spawnAt(Calendar.APRIL, 1); spawnAt(Calendar.JUNE, 1); spawnAt(Calendar.OCTOBER, 31); }
From source file:ch.cyberduck.core.ftp.parser.UnixFTPEntryParserTest.java
@Test public void testParseTimestamp() { FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX"); FTPFile parsed;/* w w w .java 2s . c o m*/ parsed = parser .parseFTPEntry("drw-rw-rw- 1 user ftp 0 DEC 11 20:56 ADMIN_Documentation"); assertNotNull(parsed); assertNotNull(parsed.getTimestamp()); assertEquals(Calendar.DECEMBER, parsed.getTimestamp().get(Calendar.MONTH)); assertEquals(11, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH)); assertEquals(20, parsed.getTimestamp().get(Calendar.HOUR_OF_DAY)); assertEquals(56, parsed.getTimestamp().get(Calendar.MINUTE)); parsed = parser.parseFTPEntry("drwxr-xr-x 3 ftp ftp 512 Mar 15 2004 doc"); assertNotNull(parsed); assertNotNull(parsed.getTimestamp()); assertEquals(2004, parsed.getTimestamp().get(Calendar.YEAR)); assertEquals(Calendar.MARCH, parsed.getTimestamp().get(Calendar.MONTH)); assertEquals(15, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH)); parsed = parser.parseFTPEntry("drwxrwxr-x 2 ftp ftp 512 Oct 23 2007 aurox"); assertNotNull(parsed); assertNotNull(parsed.getTimestamp()); assertEquals(2007, parsed.getTimestamp().get(Calendar.YEAR)); assertEquals(Calendar.OCTOBER, parsed.getTimestamp().get(Calendar.MONTH)); assertEquals(23, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH)); }
From source file:util.MyUtils.java
public static String getMonthString(int month) { switch (month - 1) { case Calendar.JANUARY: return "Jan"; case Calendar.FEBRUARY: return "Feb"; case Calendar.MARCH: return "Mar"; case Calendar.APRIL: return "Apr"; case Calendar.MAY: return "May"; case Calendar.JUNE: return "Jun"; case Calendar.JULY: return "Jul"; case Calendar.AUGUST: return "Aug"; case Calendar.SEPTEMBER: return "Sep"; case Calendar.OCTOBER: return "Oct"; case Calendar.NOVEMBER: return "Nov"; case Calendar.DECEMBER: return "Dec"; }// w ww. java 2 s .c om return ""; }
From source file:de.forsthaus.backend.dao.impl.ChartDataDAOImpl.java
@Override public List<ChartData> getChartDataForCustomer(long kunId) { List<ChartData> result = new ArrayList<ChartData>(); if (kunId == 20) { Calendar calendar = new GregorianCalendar(); calendar.set(2009, Calendar.JANUARY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(120.30))); calendar.set(2009, Calendar.FEBRUARY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(450.30))); calendar.set(2009, Calendar.MARCH, 15, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(820.10))); calendar.set(2009, Calendar.APRIL, 20, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(654.00))); calendar.set(2009, Calendar.MAY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(120.30))); calendar.set(2009, Calendar.JUNE, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(520.30))); calendar.set(2009, Calendar.JULY, 22, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(320.30))); calendar.set(2009, Calendar.AUGUST, 13, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(20.30))); calendar.set(2009, Calendar.SEPTEMBER, 6, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(480.30))); calendar.set(2009, Calendar.OCTOBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(520.30))); calendar.set(2009, Calendar.NOVEMBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(620.70))); calendar.set(2009, Calendar.DECEMBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(1220.90))); } else if (kunId == 21) { Calendar calendar = new GregorianCalendar(); calendar.set(2009, Calendar.JANUARY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(320.30))); calendar.set(2009, Calendar.FEBRUARY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(450.30))); calendar.set(2009, Calendar.MARCH, 15, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(620.10))); calendar.set(2009, Calendar.APRIL, 20, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(154.00))); calendar.set(2009, Calendar.MAY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(320.30))); calendar.set(2009, Calendar.JUNE, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(620.30))); calendar.set(2009, Calendar.JULY, 22, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(920.30))); calendar.set(2009, Calendar.AUGUST, 13, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(120.30))); calendar.set(2009, Calendar.SEPTEMBER, 6, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(680.30))); calendar.set(2009, Calendar.OCTOBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(580.30))); calendar.set(2009, Calendar.NOVEMBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(820.70))); calendar.set(2009, Calendar.DECEMBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(220.90))); }/*from w w w . j a v a 2 s.c om*/ return result; }
From source file:one.GanttDemo1.java
/** * Creates a sample dataset for a Gantt chart. * * @return The dataset./* w ww .j a va 2 s. c o m*/ */ public static IntervalCategoryDataset createDataset() { final TaskSeries s1 = new TaskSeries("Scheduled"); s1.add(new Task("Write Proposal", new SimpleTimePeriod(date(1, Calendar.APRIL, 2001), date(5, Calendar.APRIL, 2001)))); 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)))); s1.add(new Task("Database set up", new SimpleTimePeriod(date(15, Calendar.OCTOBER, 2001), date(30, Calendar.OCTOBER, 2001)))); final TaskSeries s2 = new TaskSeries("Actual"); s2.add(new Task("Write Proposal", new SimpleTimePeriod(date(1, Calendar.APRIL, 2001), date(5, Calendar.APRIL, 2001)))); s2.add(new Task("Obtain Approval", new SimpleTimePeriod(date(9, Calendar.APRIL, 2001), date(9, Calendar.APRIL, 2001)))); s2.add(new Task("Requirements Analysis", new SimpleTimePeriod(date(10, Calendar.APRIL, 2001), date(15, Calendar.MAY, 2001)))); s2.add(new Task("Design Phase", new SimpleTimePeriod(date(15, Calendar.MAY, 2001), date(17, Calendar.JUNE, 2001)))); s2.add(new Task("Design Signoff", new SimpleTimePeriod(date(30, Calendar.JUNE, 2001), date(30, Calendar.JUNE, 2001)))); s2.add(new Task("Alpha Implementation", new SimpleTimePeriod(date(1, Calendar.JULY, 2001), date(12, Calendar.SEPTEMBER, 2001)))); s2.add(new Task("Design Review", new SimpleTimePeriod(date(12, Calendar.SEPTEMBER, 2001), date(22, Calendar.SEPTEMBER, 2001)))); s2.add(new Task("Revised Design Signoff", new SimpleTimePeriod(date(25, Calendar.SEPTEMBER, 2001), date(27, Calendar.SEPTEMBER, 2001)))); s2.add(new Task("Beta Implementation", new SimpleTimePeriod(date(27, Calendar.SEPTEMBER, 2001), date(30, Calendar.OCTOBER, 2001)))); s2.add(new Task("Testing", new SimpleTimePeriod(date(31, Calendar.OCTOBER, 2001), date(17, Calendar.NOVEMBER, 2001)))); s2.add(new Task("Final Implementation", new SimpleTimePeriod(date(18, Calendar.NOVEMBER, 2001), date(5, Calendar.DECEMBER, 2001)))); s2.add(new Task("Signoff", new SimpleTimePeriod(date(10, Calendar.DECEMBER, 2001), date(11, Calendar.DECEMBER, 2001)))); final TaskSeriesCollection collection = new TaskSeriesCollection(); collection.add(s1); collection.add(s2); return collection; }
From source file:org.energyos.espi.datacustodian.utils.factories.EspiFactory.java
public static UsagePoint newUsagePoint(RetailCustomer retailCustomer) { UsagePoint usagePoint = newSimpleUsagePoint(); usagePoint.setRetailCustomer(retailCustomer); usagePoint.addMeterReading(newMeterReading()); usagePoint.addElectricPowerUsageSummary(newElectricPowerUsageSummary()); usagePoint.addElectricPowerQualitySummary(newElectricPowerQualitySummary()); usagePoint.setLocalTimeParameters(newLocalTimeParameters()); usagePoint.getRelatedLinks().add(new LinkType("related", usagePoint.getSelfHref() + "/MeterReading")); usagePoint.getRelatedLinks()//from w ww . j a v a 2 s . c o m .add(new LinkType("related", usagePoint.getSelfHref() + "/ElectricPowerUsageSummary")); usagePoint.getRelatedLinks() .add(new LinkType("related", usagePoint.getSelfHref() + "/ElectricPowerQualitySummary")); GregorianCalendar published = new GregorianCalendar(2012, Calendar.NOVEMBER, 15, 0, 0, 0); published.setTimeZone(TimeZone.getTimeZone("UTC")); usagePoint.setPublished(published); GregorianCalendar updated = new GregorianCalendar(2012, Calendar.OCTOBER, 24, 0, 0, 0); updated.setTimeZone(TimeZone.getTimeZone("UTC")); usagePoint.setUpdated(updated); return usagePoint; }
From source file:com.mycompany.CRMFly.serviceLayer.ClientsServiceImpl.java
@Transactional public Map<Date, Double> getSumsFotDates(Clients client) { Long id = client.getId();/*from ww w .ja v a2s .co m*/ Calendar calendar = new GregorianCalendar(); Integer monthDifference = 0; if (calendar.get(Calendar.MONTH) == Calendar.JANUARY || calendar.get(Calendar.MONTH) == Calendar.APRIL || calendar.get(Calendar.MONTH) == Calendar.JULY || calendar.get(Calendar.MONTH) == Calendar.OCTOBER) { monthDifference = 0; } else if (calendar.get(Calendar.MONTH) == Calendar.FEBRUARY || calendar.get(Calendar.MONTH) == Calendar.MAY || calendar.get(Calendar.MONTH) == Calendar.AUGUST || calendar.get(Calendar.MONTH) == Calendar.NOVEMBER) { monthDifference = -1; } else if (calendar.get(Calendar.MONTH) == Calendar.MARCH || calendar.get(Calendar.MONTH) == Calendar.JUNE || calendar.get(Calendar.MONTH) == Calendar.SEPTEMBER || calendar.get(Calendar.MONTH) == Calendar.DECEMBER) monthDifference = -2; // Integer dayDifference = -calendar.get(Calendar.DAY_OF_MONTH); calendar.add(Calendar.MONTH, monthDifference); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.HOUR, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); // calendar.add(Calendar.DAY_OF_MONTH, dayDifference-1); Date beginningOfQuarter = calendar.getTime(); Double thisQuarterSum = 0.0; calendar.add(Calendar.MONTH, -3); Date QuarterBackOne = calendar.getTime(); Double QuarterBackOneSum = 0.0; calendar.add(Calendar.MONTH, -3); Date QuarterBackTwo = calendar.getTime(); Double QuarterBackTwoSum = 0.0; calendar.add(Calendar.MONTH, -3); Date QuarterBackThree = calendar.getTime(); Double QuarterBackThreeSum = 0.0; List<Contracts> contracts = clientsDAO.getContractsForClient(id); HashMap<Date, Double> sums = new HashMap<Date, Double>(); for (Contracts contract : contracts) { Date date = contract.getBegin_date(); if (date.after(beginningOfQuarter)) thisQuarterSum += contract.getTotalSum(); else if (date.after(QuarterBackOne)) QuarterBackOneSum += contract.getTotalSum(); else if (date.after(QuarterBackTwo)) QuarterBackTwoSum += contract.getTotalSum(); else if (date.after(QuarterBackThree)) QuarterBackThreeSum += contract.getTotalSum(); } sums.put(beginningOfQuarter, thisQuarterSum); sums.put(QuarterBackOne, QuarterBackOneSum); sums.put(QuarterBackTwo, QuarterBackTwoSum); sums.put(QuarterBackThree, QuarterBackThreeSum); return sums; }
From source file:org.energyos.espi.common.test.EspiFactory.java
public static UsagePoint newUsagePoint(RetailCustomer retailCustomer) { UsagePoint usagePoint = newSimpleUsagePoint(); usagePoint.setRetailCustomer(retailCustomer); usagePoint.addMeterReading(newMeterReading()); usagePoint.addElectricPowerUsageSummary(newElectricPowerUsageSummary()); usagePoint.addElectricPowerQualitySummary(newElectricPowerQualitySummary()); usagePoint.setLocalTimeParameters(newLocalTimeParameters()); usagePoint.getRelatedLinks().add(new LinkType("related", usagePoint.getSelfHref() + "/MeterReading")); usagePoint.getRelatedLinks()/*from ww w . ja v a2 s.c om*/ .add(new LinkType("related", usagePoint.getSelfHref() + "/ElectricPowerUsageSummary")); usagePoint.getRelatedLinks() .add(new LinkType("related", usagePoint.getSelfHref() + "/ElectricPowerQualitySummary")); usagePoint.setSelfLink(new LinkType("self", usagePoint.getSelfHref())); usagePoint.setUpLink(new LinkType("up", usagePoint.getUpHref())); GregorianCalendar published = new GregorianCalendar(2012, Calendar.NOVEMBER, 15, 0, 0, 0); published.setTimeZone(TimeZone.getTimeZone("UTC")); usagePoint.setPublished(published); GregorianCalendar updated = new GregorianCalendar(2012, Calendar.OCTOBER, 24, 0, 0, 0); updated.setTimeZone(TimeZone.getTimeZone("UTC")); usagePoint.setUpdated(updated); return usagePoint; }
From source file:org.techytax.util.DateHelper.java
public static FiscalPeriod getLastVatPeriodPreviousYear() { Calendar cal = new GregorianCalendar(); cal.setTime(new Date()); cal.add(Calendar.YEAR, -1);//ww w.j ava2s. c o m cal.set(Calendar.MONTH, Calendar.OCTOBER); cal.set(Calendar.DAY_OF_MONTH, 1); Date beginDatum = cal.getTime(); cal.set(Calendar.MONTH, Calendar.DECEMBER); cal.set(Calendar.DAY_OF_MONTH, 31); Date eindDatum = cal.getTime(); return new FiscalPeriod(beginDatum, eindDatum); }
From source file:com.mycompany.CRMFly.serviceLayer.ProductsServiceImpl.java
@Transactional public Map<Date, Double> getSumsFotDates(Products product) { Long id = product.getId();//from w w w . j av a 2s . c om Calendar calendar = new GregorianCalendar(); Integer monthDifference = 0; if (calendar.get(Calendar.MONTH) == Calendar.JANUARY || calendar.get(Calendar.MONTH) == Calendar.APRIL || calendar.get(Calendar.MONTH) == Calendar.JULY || calendar.get(Calendar.MONTH) == Calendar.OCTOBER) { monthDifference = 0; } else if (calendar.get(Calendar.MONTH) == Calendar.FEBRUARY || calendar.get(Calendar.MONTH) == Calendar.MAY || calendar.get(Calendar.MONTH) == Calendar.AUGUST || calendar.get(Calendar.MONTH) == Calendar.NOVEMBER) { monthDifference = -1; } else if (calendar.get(Calendar.MONTH) == Calendar.MARCH || calendar.get(Calendar.MONTH) == Calendar.JUNE || calendar.get(Calendar.MONTH) == Calendar.SEPTEMBER || calendar.get(Calendar.MONTH) == Calendar.DECEMBER) monthDifference = -2; Integer dayDifference = -calendar.get(Calendar.DAY_OF_MONTH); calendar.add(Calendar.MONTH, monthDifference); calendar.add(Calendar.DAY_OF_MONTH, dayDifference - 1); Date beginningOfQuarter = calendar.getTime(); Double thisQuarterSum = 0.0; calendar.add(Calendar.MONTH, -3); Date QuarterBackOne = calendar.getTime(); Double QuarterBackOneSum = 0.0; calendar.add(Calendar.MONTH, -3); Date QuarterBackTwo = calendar.getTime(); Double QuarterBackTwoSum = 0.0; calendar.add(Calendar.MONTH, -3); Date QuarterBackThree = calendar.getTime(); Double QuarterBackThreeSum = 0.0; List<PositionsInContract> positions = productsDAO.getContractPositionsForProduct(id); HashMap<Date, Double> sums = new HashMap<Date, Double>(); for (PositionsInContract position : positions) { Long posID = position.getId(); Contracts contract = productsDAO.getContractForPosition(posID); Date date = contract.getBegin_date(); if (date.after(beginningOfQuarter)) thisQuarterSum += position.getPrice() * position.getQuantity(); else if (date.after(QuarterBackOne)) QuarterBackOneSum += position.getPrice() * position.getQuantity(); else if (date.after(QuarterBackTwo)) QuarterBackTwoSum += position.getPrice() * position.getQuantity(); else if (date.after(QuarterBackThree)) QuarterBackThreeSum += position.getPrice() * position.getQuantity(); } sums.put(beginningOfQuarter, thisQuarterSum); sums.put(QuarterBackOne, QuarterBackOneSum); sums.put(QuarterBackTwo, QuarterBackTwoSum); sums.put(QuarterBackThree, QuarterBackThreeSum); return sums; }