Example usage for java.util Calendar AUGUST

List of usage examples for java.util Calendar AUGUST

Introduction

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

Prototype

int AUGUST

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

Click Source Link

Document

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

Usage

From source file:netmason.support.graphics.GanttDisplay.java

/**
 * Creates a sample dataset for a Gantt chart, using sub-tasks. In general,
 * you won't hard-code the dataset in this way - it's done here so that the
 * demo is self-contained./* w  w  w.  ja v a 2s .  co m*/
 * 
 * @return The dataset.
 */
private IntervalCategoryDataset createSampleDataset() {

    final Task t1 = new Task("Write Proposal", date(1, Calendar.APRIL, 2001), date(5, Calendar.APRIL, 2001));
    t1.setPercentComplete(1.00);
    s1.add(t1);

    final Task t2 = new Task("Obtain Approval", date(9, Calendar.APRIL, 2001), date(9, Calendar.APRIL, 2001));
    t2.setPercentComplete(1.00);
    s1.add(t2);

    // here is a task split into two subtasks...
    final Task t3 = new Task("Requirements Analysis", date(10, Calendar.APRIL, 2001),
            date(5, Calendar.MAY, 2001));
    final Task st31 = new Task("Requirements 1", date(10, Calendar.APRIL, 2001),
            date(25, Calendar.APRIL, 2001));
    st31.setPercentComplete(1.0);
    final Task st32 = new Task("Requirements 2", date(1, Calendar.MAY, 2001), date(5, Calendar.MAY, 2001));
    st32.setPercentComplete(1.0);
    t3.addSubtask(st31);
    t3.addSubtask(st32);
    s1.add(t3);

    // and another...
    final Task t4 = new Task("Design Phase", date(6, Calendar.MAY, 2001), date(30, Calendar.MAY, 2001));
    final Task st41 = new Task("Design 1", date(6, Calendar.MAY, 2001), date(10, Calendar.MAY, 2001));
    st41.setPercentComplete(1.0);
    final Task st42 = new Task("Design 2", date(15, Calendar.MAY, 2001), date(20, Calendar.MAY, 2001));
    st42.setPercentComplete(1.0);
    final Task st43 = new Task("Design 3", date(23, Calendar.MAY, 2001), date(30, Calendar.MAY, 2001));
    st43.setPercentComplete(0.50);
    t4.addSubtask(st41);
    t4.addSubtask(st42);
    t4.addSubtask(st43);
    s1.add(t4);

    final Task t5 = new Task("Design Signoff", date(2, Calendar.JUNE, 2001), date(2, Calendar.JUNE, 2001));
    s1.add(t5);

    final Task t6 = new Task("Alpha Implementation", date(3, Calendar.JUNE, 2001),
            date(31, Calendar.JULY, 2001));
    t6.setPercentComplete(0.60);

    s1.add(t6);

    final Task t7 = new Task("Design Review", date(1, Calendar.AUGUST, 2001), date(8, Calendar.AUGUST, 2001));
    t7.setPercentComplete(0.0);
    s1.add(t7);

    final Task t8 = new Task("Revised Design Signoff", date(10, Calendar.AUGUST, 2001),
            date(10, Calendar.AUGUST, 2001));
    t8.setPercentComplete(0.0);
    s1.add(t8);

    final Task t9 = new Task("Beta Implementation", date(12, Calendar.AUGUST, 2001),
            date(12, Calendar.SEPTEMBER, 2001));
    t9.setPercentComplete(0.0);
    s1.add(t9);

    final Task t10 = new Task("Testing", date(13, Calendar.SEPTEMBER, 2001), date(31, Calendar.OCTOBER, 2001));
    t10.setPercentComplete(0.0);
    s1.add(t10);

    final Task t11 = new Task("Final Implementation", date(1, Calendar.NOVEMBER, 2001),
            date(15, Calendar.NOVEMBER, 2001));
    t11.setPercentComplete(0.0);
    s1.add(t11);

    final Task t12 = new Task("Signoff", date(28, Calendar.NOVEMBER, 2001), date(30, Calendar.NOVEMBER, 2001));
    t12.setPercentComplete(0.0);
    s1.add(t12);

    final TaskSeriesCollection collection = new TaskSeriesCollection();
    collection.add(s1);

    return collection;
}

From source file:org.jfree.chart.demo.GanttDemo2.java

/**
 * Creates a sample dataset for a Gantt chart, using sub-tasks.  In general, you won't 
 * hard-code the dataset in this way - it's done here so that the demo is self-contained.
 *
 * @return The dataset./*  w ww  .  j av  a 2s . c o  m*/
 */
private IntervalCategoryDataset createSampleDataset() {

    final TaskSeries s1 = new TaskSeries("Scheduled");

    final Task t1 = new Task("Write Proposal", date(1, Calendar.APRIL, 2001), date(5, Calendar.APRIL, 2001));
    t1.setPercentComplete(1.00);
    s1.add(t1);

    final Task t2 = new Task("Obtain Approval", date(9, Calendar.APRIL, 2001), date(9, Calendar.APRIL, 2001));
    t2.setPercentComplete(1.00);
    s1.add(t2);

    // here is a task split into two subtasks...
    final Task t3 = new Task("Requirements Analysis", date(10, Calendar.APRIL, 2001),
            date(5, Calendar.MAY, 2001));
    final Task st31 = new Task("Requirements 1", date(10, Calendar.APRIL, 2001),
            date(25, Calendar.APRIL, 2001));
    st31.setPercentComplete(1.0);
    final Task st32 = new Task("Requirements 2", date(1, Calendar.MAY, 2001), date(5, Calendar.MAY, 2001));
    st32.setPercentComplete(1.0);
    t3.addSubtask(st31);
    t3.addSubtask(st32);
    s1.add(t3);

    // and another...
    final Task t4 = new Task("Design Phase", date(6, Calendar.MAY, 2001), date(30, Calendar.MAY, 2001));
    final Task st41 = new Task("Design 1", date(6, Calendar.MAY, 2001), date(10, Calendar.MAY, 2001));
    st41.setPercentComplete(1.0);
    final Task st42 = new Task("Design 2", date(15, Calendar.MAY, 2001), date(20, Calendar.MAY, 2001));
    st42.setPercentComplete(1.0);
    final Task st43 = new Task("Design 3", date(23, Calendar.MAY, 2001), date(30, Calendar.MAY, 2001));
    st43.setPercentComplete(0.50);
    t4.addSubtask(st41);
    t4.addSubtask(st42);
    t4.addSubtask(st43);
    s1.add(t4);

    final Task t5 = new Task("Design Signoff", date(2, Calendar.JUNE, 2001), date(2, Calendar.JUNE, 2001));
    s1.add(t5);

    final Task t6 = new Task("Alpha Implementation", date(3, Calendar.JUNE, 2001),
            date(31, Calendar.JULY, 2001));
    t6.setPercentComplete(0.60);

    s1.add(t6);

    final Task t7 = new Task("Design Review", date(1, Calendar.AUGUST, 2001), date(8, Calendar.AUGUST, 2001));
    t7.setPercentComplete(0.0);
    s1.add(t7);

    final Task t8 = new Task("Revised Design Signoff", date(10, Calendar.AUGUST, 2001),
            date(10, Calendar.AUGUST, 2001));
    t8.setPercentComplete(0.0);
    s1.add(t8);

    final Task t9 = new Task("Beta Implementation", date(12, Calendar.AUGUST, 2001),
            date(12, Calendar.SEPTEMBER, 2001));
    t9.setPercentComplete(0.0);
    s1.add(t9);

    final Task t10 = new Task("Testing", date(13, Calendar.SEPTEMBER, 2001), date(31, Calendar.OCTOBER, 2001));
    t10.setPercentComplete(0.0);
    s1.add(t10);

    final Task t11 = new Task("Final Implementation", date(1, Calendar.NOVEMBER, 2001),
            date(15, Calendar.NOVEMBER, 2001));
    t11.setPercentComplete(0.0);
    s1.add(t11);

    final Task t12 = new Task("Signoff", date(28, Calendar.NOVEMBER, 2001), date(30, Calendar.NOVEMBER, 2001));
    t12.setPercentComplete(0.0);
    s1.add(t12);

    final TaskSeriesCollection collection = new TaskSeriesCollection();
    collection.add(s1);

    return collection;
}

From source file:com.gemstone.gemfire.rest.internal.web.controllers.RestAPIsWithSSLDUnitTest.java

public void doPutsInClientCache() {
    ClientCache cache = GemFireCacheImpl.getInstance();
    assertNotNull(cache);//from w  w  w .j  a  va  2  s. c  o  m
    Region<String, Object> region = cache.getRegion(PEOPLE_REGION_NAME);

    // put person object
    final Person person1 = new Person(101L, "Mithali", "Dorai", "Raj",
            DateTimeUtils.createDate(1982, Calendar.DECEMBER, 4), Gender.FEMALE);
    final Person person2 = new Person(102L, "Sachin", "Ramesh", "Tendulkar",
            DateTimeUtils.createDate(1975, Calendar.DECEMBER, 14), Gender.MALE);
    final Person person3 = new Person(103L, "Saurabh", "Baburav", "Ganguly",
            DateTimeUtils.createDate(1972, Calendar.AUGUST, 29), Gender.MALE);
    final Person person4 = new Person(104L, "Rahul", "subrymanyam", "Dravid",
            DateTimeUtils.createDate(1979, Calendar.MARCH, 17), Gender.MALE);
    final Person person5 = new Person(105L, "Jhulan", "Chidambaram", "Goswami",
            DateTimeUtils.createDate(1983, Calendar.NOVEMBER, 25), Gender.FEMALE);

    region.put("1", person1);
    region.put("2", person2);
    region.put("3", person3);
    region.put("4", person4);
    region.put("5", person5);

    final Person person6 = new Person(101L, "Rahul", "Rajiv", "Gndhi",
            DateTimeUtils.createDate(1970, Calendar.MAY, 14), Gender.MALE);
    final Person person7 = new Person(102L, "Narendra", "Damodar", "Modi",
            DateTimeUtils.createDate(1945, Calendar.DECEMBER, 24), Gender.MALE);
    final Person person8 = new Person(103L, "Atal", "Bihari", "Vajpayee",
            DateTimeUtils.createDate(1920, Calendar.AUGUST, 9), Gender.MALE);
    final Person person9 = new Person(104L, "Soniya", "Rajiv", "Gandhi",
            DateTimeUtils.createDate(1929, Calendar.MARCH, 27), Gender.FEMALE);
    final Person person10 = new Person(104L, "Priyanka", "Robert", "Gandhi",
            DateTimeUtils.createDate(1973, Calendar.APRIL, 15), Gender.FEMALE);

    final Person person11 = new Person(104L, "Murali", "Manohar", "Joshi",
            DateTimeUtils.createDate(1923, Calendar.APRIL, 25), Gender.MALE);
    final Person person12 = new Person(104L, "Lalkrishna", "Parmhansh", "Advani",
            DateTimeUtils.createDate(1910, Calendar.JANUARY, 01), Gender.MALE);
    final Person person13 = new Person(104L, "Shushma", "kumari", "Swaraj",
            DateTimeUtils.createDate(1943, Calendar.AUGUST, 10), Gender.FEMALE);
    final Person person14 = new Person(104L, "Arun", "raman", "jetly",
            DateTimeUtils.createDate(1942, Calendar.OCTOBER, 27), Gender.MALE);
    final Person person15 = new Person(104L, "Amit", "kumar", "shah",
            DateTimeUtils.createDate(1958, Calendar.DECEMBER, 21), Gender.MALE);
    final Person person16 = new Person(104L, "Shila", "kumari", "Dixit",
            DateTimeUtils.createDate(1927, Calendar.FEBRUARY, 15), Gender.FEMALE);

    Map<String, Object> userMap = new HashMap<String, Object>();
    userMap.put("6", person6);
    userMap.put("7", person7);
    userMap.put("8", person8);
    userMap.put("9", person9);
    userMap.put("10", person10);
    userMap.put("11", person11);
    userMap.put("12", person12);
    userMap.put("13", person13);
    userMap.put("14", person14);
    userMap.put("15", person15);
    userMap.put("16", person16);

    region.putAll(userMap);

    if (cache != null)
        cache.getLogger().info("Gemfire Cache Client: Puts successfully done");

}

From source file:ISO8601DateTimeFormat.java

/**
 * Write century, year, and months.//from w w  w. j  av a  2 s .c  om
 * @param sbuf The buffer to append the string.
 */
protected final void writeCCYYMM(StringBuffer sbuf) {
    int year = calendar.get(Calendar.YEAR);
    appendInt(sbuf, year, 4);

    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);
    appendInt(sbuf, day, 2);
}

From source file:net.audumla.astronomy.algorithims.AstronomicalTest.java

@Test
public void testWrapperMethodsRome() throws Exception {
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/Rome"));
    CelestialObject sun = new Sun();
    Calendar c = Calendar.getInstance(TimeZone.getDefault());
    c.setTimeInMillis(0);// ww w. j a  v a  2  s  .c  o m
    c.set(Calendar.YEAR, 2009);
    c.set(Calendar.MONTH, Calendar.AUGUST);
    c.set(Calendar.DAY_OF_MONTH, 8);

    Date date = c.getTime();
    Geolocation.Location location = new Geolocation.Location();
    location.setLatitude(41.9000, Geolocation.Direction.NORTH);
    location.setLongitude(12.5000, Geolocation.Direction.EAST);
    TransitDetails details = sun.getTransitDetails(date, location, Sun.CIVIL);
    logger.debug("Rome");
    logger.debug("Date    : " + date);
    logger.debug("Julian  : " + new JulianDate(date).julian());
    logger.debug("Sunrise : Algorithms: " + details.getRiseTime() + " : " + details.getRiseTime().getTime());
    logger.debug("Sunset  : Algorithms: " + details.getSetTime() + " : " + details.getSetTime().getTime());
    Assert.assertEquals(details.getRiseTime().getTime(), 1249702797298l, 1000);
    Assert.assertEquals(details.getSetTime().getTime(), 1249757426299l, 1000);
}

From source file:com.mb.framework.util.DateTimeUtil.java

/**
 * This method is used for getting month long description
 * //from w  w  w.  ja v  a  2  s .com
 * @param mthNum
 * @return
 */
public static String getMonthLongDesc(int mthNum) {
    String mthLongDesc;

    switch (mthNum) {
    case Calendar.JANUARY: {
        mthLongDesc = DateTimeConstants.JANUARY;
        break;
    }
    case Calendar.FEBRUARY: {
        mthLongDesc = DateTimeConstants.FEBRUARY;
        break;
    }
    case Calendar.MARCH: {
        mthLongDesc = DateTimeConstants.MARCH;
        break;
    }
    case Calendar.APRIL: {
        mthLongDesc = DateTimeConstants.APRIL;
        break;
    }
    case Calendar.MAY: {
        mthLongDesc = DateTimeConstants.MAY;
        break;
    }
    case Calendar.JUNE: {
        mthLongDesc = DateTimeConstants.JUNE;
        break;
    }
    case Calendar.JULY: {
        mthLongDesc = DateTimeConstants.JULY;
        break;
    }
    case Calendar.AUGUST: {
        mthLongDesc = DateTimeConstants.AUGUST;
        break;
    }
    case Calendar.SEPTEMBER: {
        mthLongDesc = DateTimeConstants.SEPTEMBER;
        break;
    }
    case Calendar.OCTOBER: {
        mthLongDesc = DateTimeConstants.OCTOBER;
        break;
    }
    case Calendar.NOVEMBER: {
        mthLongDesc = DateTimeConstants.NOVEMBER;
        break;
    }
    case Calendar.DECEMBER: {
        mthLongDesc = DateTimeConstants.DECEMBER;
        break;
    }
    default: {
        mthLongDesc = "";
        break;
    }
    }

    return mthLongDesc;
}

From source file:org.apache.logging.log4j.core.util.datetime.FastDateParserTest.java

@Test
public void testAmPm() throws ParseException {
    final Calendar cal = Calendar.getInstance(NEW_YORK, Locale.US);
    cal.clear();//from   w  w  w.j  a  v a2 s.  c  o m

    final DateParser h = getInstance("yyyy-MM-dd hh a mm:ss", NEW_YORK, Locale.US);
    final DateParser K = getInstance("yyyy-MM-dd KK a mm:ss", NEW_YORK, Locale.US);
    final DateParser k = getInstance("yyyy-MM-dd kk:mm:ss", NEW_YORK, Locale.US);
    final DateParser H = getInstance("yyyy-MM-dd HH:mm:ss", NEW_YORK, Locale.US);

    cal.set(2010, Calendar.AUGUST, 1, 0, 33, 20);
    assertEquals(cal.getTime(), h.parse("2010-08-01 12 AM 33:20"));
    assertEquals(cal.getTime(), K.parse("2010-08-01 0 AM 33:20"));
    assertEquals(cal.getTime(), k.parse("2010-08-01 00:33:20"));
    assertEquals(cal.getTime(), H.parse("2010-08-01 00:33:20"));

    cal.set(2010, Calendar.AUGUST, 1, 3, 33, 20);
    assertEquals(cal.getTime(), h.parse("2010-08-01 3 AM 33:20"));
    assertEquals(cal.getTime(), K.parse("2010-08-01 3 AM 33:20"));
    assertEquals(cal.getTime(), k.parse("2010-08-01 03:33:20"));
    assertEquals(cal.getTime(), H.parse("2010-08-01 03:33:20"));

    cal.set(2010, Calendar.AUGUST, 1, 15, 33, 20);
    assertEquals(cal.getTime(), h.parse("2010-08-01 3 PM 33:20"));
    assertEquals(cal.getTime(), K.parse("2010-08-01 3 PM 33:20"));
    assertEquals(cal.getTime(), k.parse("2010-08-01 15:33:20"));
    assertEquals(cal.getTime(), H.parse("2010-08-01 15:33:20"));

    cal.set(2010, Calendar.AUGUST, 1, 12, 33, 20);
    assertEquals(cal.getTime(), h.parse("2010-08-01 12 PM 33:20"));
    assertEquals(cal.getTime(), K.parse("2010-08-01 0 PM 33:20"));
    assertEquals(cal.getTime(), k.parse("2010-08-01 12:33:20"));
    assertEquals(cal.getTime(), H.parse("2010-08-01 12:33:20"));
}

From source file:edu.mayo.informatics.lexgrid.convert.directConversions.UMLSHistoryFileToSQL.java

private Date getSystemReleaseDate(String releaseId) throws Exception {
    String sYear = releaseId.substring(0, 4);
    int year = new Integer(sYear).intValue();

    String sMonth = releaseId.substring(4);
    int mon = 0;/*from w w  w .ja v  a 2  s. co  m*/

    Calendar cal = Calendar.getInstance();
    if ("AA".equalsIgnoreCase(sMonth)) {
        mon = Calendar.JANUARY;
    } else if ("AB".equalsIgnoreCase(sMonth)) {
        mon = Calendar.APRIL;
    } else if ("AC".equalsIgnoreCase(sMonth)) {
        mon = Calendar.JULY;
    } else if ("AD".equalsIgnoreCase(sMonth)) {
        mon = Calendar.OCTOBER;
    } else {
        try {
            int i = Integer.parseInt(sMonth);

            switch (i) {
            case 1:
                mon = Calendar.JANUARY;
                break;
            case 2:
                mon = Calendar.FEBRUARY;
                break;
            case 3:
                mon = Calendar.MARCH;
                break;
            case 4:
                mon = Calendar.APRIL;
                break;
            case 5:
                mon = Calendar.MAY;
                break;
            case 6:
                mon = Calendar.JUNE;
                break;
            case 7:
                mon = Calendar.JULY;
                break;
            case 8:
                mon = Calendar.AUGUST;
                break;
            case 9:
                mon = Calendar.SEPTEMBER;
                break;
            case 10:
                mon = Calendar.OCTOBER;
                break;
            case 11:
                mon = Calendar.NOVEMBER;
                break;
            case 12:
                mon = Calendar.DECEMBER;
                break;

            default:
                throw new Exception("Release ID is not in required format: " + sMonth);
            }
        } catch (NumberFormatException e) {
            throw new Exception("Release ID is not in required format." + sMonth);
        }

    }
    cal.set(year, mon, 01, 0, 0, 0);
    cal.set(Calendar.MILLISECOND, 0);

    return new Date(cal.getTimeInMillis());
}

From source file:com.xing.api.JsonSerializationTest.java

private static void assertSchools(XingUser user) {
    School primarySchool = new School();
    primarySchool.id("42_abcdef");
    primarySchool.name("Carl-von-Ossietzky Universtt Schellenburg");
    primarySchool.degree("MSc CE/CS");
    List<String> notes = new ArrayList<>();
    notes.add("CS");
    notes.add("IT");
    notes.add("Android");
    primarySchool.notes(notes);/*from w ww . j a v a  2 s . c o  m*/
    primarySchool.beginDate(new SafeCalendar(1998, Calendar.AUGUST));
    primarySchool.endDate(new SafeCalendar(2005, Calendar.FEBRUARY));
    assertThat(user.educationBackground().primarySchool()).isEqualTo(primarySchool);

    School otherSchool = new School();
    otherSchool.id("42_abcdef");
    otherSchool.name("Carl-von-Ossietzky Universtt Schellenburg");
    otherSchool.degree("MSc CE/CS");
    otherSchool.subject("CE");
    otherSchool.beginDate(new SafeCalendar(1998, Calendar.AUGUST));
    otherSchool.endDate(new SafeCalendar(2005, Calendar.FEBRUARY));
    assertThat(user.educationBackground().schools()).containsExactly(otherSchool);
}

From source file:com.mb.framework.util.DateTimeUtil.java

/**
 * This method is used for getting calendar number of month by month
 * description// ww  w  .  j  a v  a 2  s.c o  m
 * 
 * @param monthDescr
 * @return
 */
public static int getMonthNum(String monthDescr) {
    int numOfMonth = -1;
    if (DateTimeConstants.JANUARY.equals(monthDescr)) {
        numOfMonth = Calendar.JANUARY;
    }
    if (DateTimeConstants.FEBRUARY.equals(monthDescr)) {
        numOfMonth = Calendar.FEBRUARY;
    }
    if (DateTimeConstants.MARCH.equals(monthDescr)) {
        numOfMonth = Calendar.MARCH;
    }
    if (DateTimeConstants.APRIL.equals(monthDescr)) {
        numOfMonth = Calendar.APRIL;
    }
    if (DateTimeConstants.MAY.equals(monthDescr)) {
        numOfMonth = Calendar.MAY;
    }
    if (DateTimeConstants.JUNE.equals(monthDescr)) {
        numOfMonth = Calendar.JUNE;
    }
    if (DateTimeConstants.JULY.equals(monthDescr)) {
        numOfMonth = Calendar.JULY;
    }
    if (DateTimeConstants.AUGUST.equals(monthDescr)) {
        numOfMonth = Calendar.AUGUST;
    }
    if (DateTimeConstants.SEPTEMBER.equals(monthDescr)) {
        numOfMonth = Calendar.SEPTEMBER;
    }
    if (DateTimeConstants.OCTOBER.equals(monthDescr)) {
        numOfMonth = Calendar.OCTOBER;
    }
    if (DateTimeConstants.NOVEMBER.equals(monthDescr)) {
        numOfMonth = Calendar.NOVEMBER;
    }
    if (DateTimeConstants.DECEMBER.equals(monthDescr)) {
        numOfMonth = Calendar.DECEMBER;
    }
    return numOfMonth;
}