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:org.jfree.data.time.DayTest.java

/**
 * Some checks for the getStart() method.
 *//*w ww .ja v a  2  s .  co m*/
@Test
public void testGetStart() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.ITALY);
    Calendar cal = Calendar.getInstance(Locale.ITALY);
    cal.set(2006, Calendar.NOVEMBER, 3, 0, 0, 0);
    cal.set(Calendar.MILLISECOND, 0);
    Day d = new Day(3, 11, 2006);
    assertEquals(cal.getTime(), d.getStart());
    Locale.setDefault(saved);
}

From source file:org.jfree.data.time.junit.DayTest.java

/**
 * Some checks for the getStart() method.
 *//*from   w ww  .  jav  a2s  . c o m*/
public void testGetStart() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.ITALY);
    Calendar cal = Calendar.getInstance(Locale.ITALY);
    cal.set(2006, Calendar.NOVEMBER, 3, 0, 0, 0);
    cal.set(Calendar.MILLISECOND, 0);
    Day d = new Day(3, 11, 2006);
    assertEquals(cal.getTime(), d.getStart());
    Locale.setDefault(saved);
}

From source file:Time.java

/**
 * Testing this class.//from  www. j  a v a 2s. co  m
 * 
 * @param args
 *          Not used.
 */
public static void main(String[] args) {
    // This proves that there are 912 days between the two major
    // terrorist attacks, not 911 as is common knowledge.
    Day september11 = new Day(2001, Calendar.SEPTEMBER, 11);
    Day march11 = new Day(2004, Calendar.MARCH, 11);
    System.out.println(september11.daysBetween(march11));

    // This proves that Kennedy was president for 1037 days,
    // not 1000 as is the popular belief nor 1036 which is the
    // bluffers reply. Nerds knows when to add one...
    Day precidency = new Day(1961, Calendar.JANUARY, 20);
    Day assasination = new Day(1963, Calendar.NOVEMBER, 22);
    System.out.println(precidency.daysBetween(assasination) + 1);

    // Niel Armstrong walked the moon on a Sunday
    Day nielOnMoon = new Day(1969, Calendar.JULY, 20);
    System.out.println(nielOnMoon.getDayNumberOfWeek());

    // Find last tuesdays for 2005
    for (int i = 0; i < 12; i++) {
        Day tuesday = Day.getLastOfMonth(Calendar.TUESDAY, i, 2005);
        System.out.println(tuesday);
    }
}

From source file:Time.java

/**
 * Return the 1-based month number of the month of this day. 1 = January, 2 =
 * February and so on./*  w  w  w.  ja v  a2 s  .co m*/
 * 
 * @return Month number of this month
 */
public int getMonthNo() {
    // It is tempting to return getMonth() + 1 but this is conceptually
    // wrong, as Calendar month is an enumeration and the values are tags
    // only and can be anything.
    switch (getMonth()) {
    case Calendar.JANUARY:
        return 1;
    case Calendar.FEBRUARY:
        return 2;
    case Calendar.MARCH:
        return 3;
    case Calendar.APRIL:
        return 4;
    case Calendar.MAY:
        return 5;
    case Calendar.JUNE:
        return 6;
    case Calendar.JULY:
        return 7;
    case Calendar.AUGUST:
        return 8;
    case Calendar.SEPTEMBER:
        return 9;
    case Calendar.OCTOBER:
        return 10;
    case Calendar.NOVEMBER:
        return 11;
    case Calendar.DECEMBER:
        return 12;
    }

    // This will never happen
    return 0;
}

From source file:org.apache.james.protocols.imap.utils.DecoderUtilsTest.java

@Test
public void testDecodeMonth() throws Exception {
    assertEquals(Calendar.JANUARY, DecoderUtils.decodeMonth('J', 'A', 'N'));
    assertEquals(Calendar.JANUARY, DecoderUtils.decodeMonth('j', 'a', 'n'));
    assertEquals(Calendar.FEBRUARY, DecoderUtils.decodeMonth('F', 'E', 'B'));
    assertEquals(Calendar.FEBRUARY, DecoderUtils.decodeMonth('f', 'e', 'b'));
    assertEquals(Calendar.MARCH, DecoderUtils.decodeMonth('M', 'A', 'R'));
    assertEquals(Calendar.MARCH, DecoderUtils.decodeMonth('m', 'a', 'r'));
    assertEquals(Calendar.APRIL, DecoderUtils.decodeMonth('A', 'P', 'R'));
    assertEquals(Calendar.APRIL, DecoderUtils.decodeMonth('a', 'p', 'r'));
    assertEquals(Calendar.MAY, DecoderUtils.decodeMonth('M', 'A', 'Y'));
    assertEquals(Calendar.MAY, DecoderUtils.decodeMonth('m', 'a', 'y'));
    assertEquals(Calendar.JUNE, DecoderUtils.decodeMonth('J', 'U', 'N'));
    assertEquals(Calendar.JUNE, DecoderUtils.decodeMonth('j', 'u', 'n'));
    assertEquals(Calendar.JULY, DecoderUtils.decodeMonth('J', 'U', 'L'));
    assertEquals(Calendar.JULY, DecoderUtils.decodeMonth('j', 'u', 'l'));
    assertEquals(Calendar.AUGUST, DecoderUtils.decodeMonth('A', 'U', 'G'));
    assertEquals(Calendar.AUGUST, DecoderUtils.decodeMonth('a', 'u', 'g'));
    assertEquals(Calendar.SEPTEMBER, DecoderUtils.decodeMonth('S', 'E', 'P'));
    assertEquals(Calendar.SEPTEMBER, DecoderUtils.decodeMonth('s', 'e', 'p'));
    assertEquals(Calendar.OCTOBER, DecoderUtils.decodeMonth('O', 'C', 'T'));
    assertEquals(Calendar.OCTOBER, DecoderUtils.decodeMonth('o', 'c', 't'));
    assertEquals(Calendar.NOVEMBER, DecoderUtils.decodeMonth('N', 'O', 'V'));
    assertEquals(Calendar.NOVEMBER, DecoderUtils.decodeMonth('n', 'o', 'v'));
    assertEquals(Calendar.DECEMBER, DecoderUtils.decodeMonth('D', 'E', 'C'));
    assertEquals(Calendar.DECEMBER, DecoderUtils.decodeMonth('d', 'e', 'c'));
}

From source file:de.gebatzens.sia.SIAApp.java

public String getSeasonTheme() {
    int m = Calendar.getInstance().get(Calendar.MONTH);
    switch (m) {/* w ww  .j a  v a 2s  .c om*/
    case Calendar.OCTOBER:
    case Calendar.NOVEMBER:
    case Calendar.DECEMBER:
    case Calendar.JANUARY:
    case Calendar.FEBRUARY:
    case Calendar.MARCH:
        return "Winter";
    default:
        return "Summer";
    }
}

From source file:org.hawkular.alerts.api.model.action.TimeConstraint.java

private int month(String sMonth) {
    if (isEmpty(sMonth)) {
        return -1;
    }//from w  w w  .jav a2  s  . c  om
    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;
    }
}

From source file:com.appeaser.sublimepickerlibrary.utilities.SUtils.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:
        // This is not correct. See isLeapYear(int) above
        //return (year % 4 == 0) ? 29 : 28;
        return isLeapYear(year) ? 29 : 28;
    default://from   w w  w .j  a  v a2s  .co m
        throw new IllegalArgumentException("Invalid Month");
    }
}

From source file:com.lloydtorres.stately.helpers.RaraHelper.java

/**
 * Determines if the current day in the EST/EDT timezone is a special day.
 * @return The special day mode/*from  w ww . j a  v  a2s  .  c  o  m*/
 */
public static int getSpecialDayStatus() {
    Calendar cal = new GregorianCalendar();
    cal.setTimeZone(SparkleHelper.TIMEZONE_TORONTO);

    int month = cal.get(Calendar.MONTH);
    int day = cal.get(Calendar.DAY_OF_MONTH);

    if (month == Calendar.JANUARY && day == 30) {
        return DAY_STATELY_BIRTHDAY;
    } else if (month == Calendar.JULY && day == 1) {
        return DAY_CANADA_DAY;
    } else if (month == Calendar.OCTOBER && day == 31) {
        return DAY_HALLOWEEN;
    } else if (month == Calendar.NOVEMBER && day == 13) {
        return DAY_NS_BIRTHDAY;
    } else {
        return DAY_NORMAL;
    }
}

From source file:br.msf.commons.util.AbstractDateUtils.java

protected static Collection<Calendar> getBrasilianHolidays(final int year) {
    Collection<Calendar> holidays = new ArrayList<>();

    // feriados fixos
    holidays.add(new GregorianCalendar(year, Calendar.JANUARY, 1)); // Confraternizacao Universal
    holidays.add(new GregorianCalendar(year, Calendar.APRIL, 21)); // Tiradentes
    holidays.add(new GregorianCalendar(year, Calendar.MAY, 1)); // Dia do Trabalho
    holidays.add(new GregorianCalendar(year, Calendar.OCTOBER, 12)); // Nossa Senhora Aparecida
    holidays.add(new GregorianCalendar(year, Calendar.NOVEMBER, 2)); // Finados
    holidays.add(new GregorianCalendar(year, Calendar.NOVEMBER, 15)); // Proclamacao da Republica
    holidays.add(new GregorianCalendar(year, Calendar.DECEMBER, 25)); // Natal

    // feriados calculados
    Calendar pascoa = getSundayOfEaster(year);
    Calendar carnaval = (Calendar) pascoa.clone();
    carnaval.add(Calendar.DAY_OF_MONTH, -47);
    Calendar corpusChristi = (Calendar) pascoa.clone();
    corpusChristi.add(Calendar.DAY_OF_MONTH, 60);

    holidays.add(carnaval); // Carnaval
    holidays.add(pascoa); // Pascoa
    holidays.add(corpusChristi); // Corpus Christi

    return holidays;
}