Example usage for java.util Calendar NOVEMBER

List of usage examples for java.util Calendar NOVEMBER

Introduction

In this page you can find the example usage for java.util Calendar NOVEMBER.

Prototype

int NOVEMBER

To view the source code for java.util Calendar NOVEMBER.

Click Source Link

Document

Value of the #MONTH field indicating the eleventh month of the year in the Gregorian and Julian calendars.

Usage

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 ww  w .  java  2 s. co  m
        throw new IllegalArgumentException("Invalid Month");
    }
}

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  a2s  .  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:net.netheos.pcsapi.providers.hubic.SwiftTest.java

@Test
public void testParseTimestamp() {
    // Check we won't break if a header is missing :
    Headers headers = new Headers();
    Date timestamp = Swift.parseTimestamp(headers);
    assertNull(timestamp);/*from   w  ww  .j  ava  2  s.  com*/

    headers.addHeader("X-Timestamp", "1383925113.43900"); // 2013-11-08T16:38:33.439+01:00
    timestamp = Swift.parseTimestamp(headers);

    Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
    cal.setTime(timestamp);
    System.out.println(timestamp);
    assertEquals(2013, cal.get(Calendar.YEAR));
    assertEquals(Calendar.NOVEMBER, cal.get(Calendar.MONTH));
    assertEquals(8, cal.get(Calendar.DAY_OF_MONTH));
    assertEquals(15, cal.get(Calendar.HOUR_OF_DAY));
    assertEquals(38, cal.get(Calendar.MINUTE));
    assertEquals(33, cal.get(Calendar.SECOND));
    assertEquals(439, cal.get(Calendar.MILLISECOND));

    checkTimestamp("1383925113.430723", new Date(1383925113430L));
    checkTimestamp("1383925113.43900", new Date(1383925113439L));
    checkTimestamp("1383925113.439", new Date(1383925113439L));
    checkTimestamp("1383925113.43", new Date(1383925113430L));
    checkTimestamp("1383925113.4", new Date(1383925113400L));
    checkTimestamp("1383925113.", new Date(1383925113000L));
    checkTimestamp("1383925113", new Date(1383925113000L));
}

From source file:ch.cyberduck.core.ftp.parser.vsFTPdEntryParserTest.java

@Test
public void testParse() throws Exception {
    FTPFile parsed;/*from   w w w  . j a v a  2 s.  c o m*/

    // #5437
    parsed = parser.parseFTPEntry("-rw-r--r--    1 3642     3643          106 Nov 15 22:20 index.html");
    assertNotNull(parsed);
    assertEquals("index.html", parsed.getName());
    assertEquals(FTPFile.FILE_TYPE, parsed.getType());
    assertEquals(106, parsed.getSize());
    assertEquals(Calendar.NOVEMBER, 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));
}

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";
    }/*from  ww  w.  j a v  a2  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 ww  w . j a  va  2 s. c  o m*/

    return result;

}

From source file:one.GanttDemo1.java

/**
 * Creates a sample dataset for a Gantt chart.
 *
 * @return The dataset.//from   w  w  w  .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.sipfoundry.sipxconfig.device.DeviceTimeZone.java

private void setDstParameters(String dstRule) {
    if (m_useDaylight) {
        // DST: Daylight Savings Time
        // LST: Local Standard Time - local time when DST is not in effect
        // LDT: Local Daylight Time - local time when DST is in effect
        if (dstRule.equals(DST_US)) {
            // http://en.wikipedia.org/wiki/Daylight_saving_time_around_the_world#North_America
            //   into DST    -  02:00 LST --> 03:00 LDT
            //   out of DST  -  02:00 LDT --> 01:00 LST

            m_startMonth = Calendar.MARCH;
            m_startWeek = 2;//from  ww  w  .  ja  v a 2 s. c o m
            m_startDayOfWeek = Calendar.SUNDAY;
            m_startTime = 2/*am*/ * MINUTES_PER_HOUR; // 02:00 LST

            m_stopMonth = Calendar.NOVEMBER;
            m_stopWeek = 1;
            m_stopDayOfWeek = Calendar.SUNDAY;
            m_stopTime = 2/*am*/ * MINUTES_PER_HOUR; // 02:00 LDT

        } else if (dstRule.equals(DST_EU)) {
            // http://en.wikipedia.org/wiki/European_Summer_Time
            //   into DST    -  01:00 GMT --> 02:00 GMT
            //   out of DST  -  01:00 GMT --> 00:00 GMT

            m_startMonth = Calendar.MARCH;
            m_startWeek = DST_LASTWEEK;
            m_startDayOfWeek = Calendar.SUNDAY;

            // LST = 01:00 GMT + Time Zone Offset
            m_startTime = (1/*am*/ * MINUTES_PER_HOUR) + getOffset();

            m_stopMonth = Calendar.OCTOBER;
            m_stopWeek = DST_LASTWEEK;
            m_stopDayOfWeek = Calendar.SUNDAY;

            // LDT = 01:00 GMT + Time Zone Offset + Daylight Savings
            m_stopTime = (1/*am*/ * MINUTES_PER_HOUR) + getOffset() + getDstSavings();

        }
    } else {
        // if we don't use DST, set the parameters to 0 to not confuse the phones
        m_startMonth = 0;
        m_startWeek = 0;
        m_startDayOfWeek = 0;
        m_startTime = 0;

        m_stopMonth = 0;
        m_stopDayOfWeek = 0;
        m_stopWeek = 0;
        m_stopTime = 0;
    }
}

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()/* ww  w.  j a  va  2  s  .  co 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:org.pivotal.gemfire.cache.CacheRegionQueryUsingToDateTest.java

@Before
public void setupPeople() {
    Region<Long, Person> localPeople = gemfireCache.getRegion("/People");

    put(localPeople, createPerson("Jon", "Doe", createDate(1979, Calendar.MAY, 15)));
    put(localPeople, createPerson("Jane", "Doe", createDate(1981, Calendar.APRIL, 21)));
    put(localPeople, createPerson("Pie", "Doe", createDate(1997, Calendar.NOVEMBER, 22)));
    put(localPeople, createPerson("Cookie", "Doe", createDate(2008, Calendar.AUGUST, 16)));
    put(localPeople, createPerson("Sour", "Doe", createDate(2012, Calendar.DECEMBER, 1)));
    put(localPeople, createPerson("Jack", "Handy", createDate(1977, Calendar.MAY, 10)));
    put(localPeople, createPerson("Sandy", "Handy", createDate(1977, Calendar.MARCH, 3)));
    put(localPeople, createPerson("Jack", "Black", createDate(1972, Calendar.JUNE, 26)));
    put(localPeople, createPerson("Ben", "Dover", createDate(1969, Calendar.MAY, 5)));
    put(localPeople, createPerson("Ima", "Pigg", createDate(1975, Calendar.JULY, 17)));

    assertThat(localPeople.size(), is(equalTo(10)));
}