Example usage for java.util Calendar JUNE

List of usage examples for java.util Calendar JUNE

Introduction

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

Prototype

int JUNE

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

Click Source Link

Document

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

Usage

From source file:br.gov.frameworkdemoiselle.internal.configuration.ConfigurationLoaderWithArrayTest.java

@Test
public void testConfigurationPropertiesWithCalendarArray() {
    ConfigurationPropertiesWithArray config = prepareConfigurationPropertiesWithArray();

    Calendar calendarValue = config.calendarArray[0];

    GregorianCalendar calendar = new GregorianCalendar(2012, Calendar.JUNE, 14, 10, 10);

    assertEquals(Calendar.class, calendarValue.getClass().getSuperclass());
    assertEquals(calendar.getTimeInMillis(), calendarValue.getTimeInMillis());
    assertEquals(3, config.calendarArray.length);
}

From source file:com.clustercontrol.systemlog.bean.SyslogMessage.java

/**
 * ??/*  w  w  w  . j  a va 2 s .  c  o m*/
 * ?(String)Calendar?(int)???
 * 
 * @param month 
 * @return Calendar?
 */
private static int editCalendarMonth(String month) {

    switch (month.toUpperCase()) {
    case "JAN":
        return Calendar.JANUARY;
    case "FEB":
        return Calendar.FEBRUARY;
    case "MAR":
        return Calendar.MARCH;
    case "APR":
        return Calendar.APRIL;
    case "MAY":
        return Calendar.MAY;
    case "JUN":
        return Calendar.JUNE;
    case "JUL":
        return Calendar.JULY;
    case "AUG":
        return Calendar.AUGUST;
    case "SEP":
        return Calendar.SEPTEMBER;
    case "OCT":
        return Calendar.OCTOBER;
    case "NOV":
        return Calendar.NOVEMBER;
    case "DEC":
        return Calendar.DECEMBER;
    }
    return Calendar.UNDECIMBER;
}

From source file:br.gov.frameworkdemoiselle.internal.configuration.ConfigurationLoaderWithListTest.java

@Test
public void testConfigurationPropertiesWithCalendarList() {
    ConfigurationPropertiesWithList config = prepareConfigurationPropertiesWithList();

    Calendar calendarValue = config.calendarList.get(0);

    GregorianCalendar calendar = new GregorianCalendar(2012, Calendar.JUNE, 14, 10, 10);

    assertEquals(Calendar.class, calendarValue.getClass().getSuperclass());
    assertEquals(calendar.getTimeInMillis(), calendarValue.getTimeInMillis());
    assertEquals(3, config.calendarList.size());
}

From source file:com.swiftcorp.portal.common.util.CalendarUtils.java

@Deprecated
public static Calendar addMonthDayToCal(Calendar cal, int month, int day) {
    Date d = new Date();
    int daysToAdd = 0;
    // Calendar cal = Calendar.getInstance();
    int currentMonth = cal.get(2);
    long t = 0;//from w w w.java  2  s  .c o m

    t = d.getTime();
    if (month > 0) {
        // cal.get ( month );
        for (int i = 0; i < month; i++) {
            if (currentMonth < 12) {
                if (currentMonth == Calendar.JANUARY) {
                    cal.set(2, Calendar.JANUARY);
                    daysToAdd += cal.getActualMaximum(Calendar.DAY_OF_MONTH);
                } else if (currentMonth == Calendar.FEBRUARY) {
                    cal.set(2, Calendar.FEBRUARY);
                    daysToAdd += cal.getActualMaximum(Calendar.DAY_OF_MONTH);
                } else if (currentMonth == Calendar.MARCH) {
                    cal.set(2, Calendar.MARCH);
                    daysToAdd += cal.getActualMaximum(Calendar.DAY_OF_MONTH);
                } else if (currentMonth == Calendar.APRIL) {
                    cal.set(2, Calendar.APRIL);
                    daysToAdd += cal.getActualMaximum(Calendar.DAY_OF_MONTH);
                } else if (currentMonth == Calendar.MAY) {
                    cal.set(2, Calendar.MAY);
                    daysToAdd += cal.getActualMaximum(Calendar.DAY_OF_MONTH);
                } else if (currentMonth == Calendar.JUNE) {
                    cal.set(2, Calendar.JUNE);
                    daysToAdd += cal.getActualMaximum(Calendar.DAY_OF_MONTH);
                } else if (currentMonth == Calendar.JULY) {
                    cal.set(2, Calendar.JULY);
                    daysToAdd += cal.getActualMaximum(Calendar.DAY_OF_MONTH);
                } else if (currentMonth == Calendar.AUGUST) {
                    cal.set(2, Calendar.AUGUST);
                    daysToAdd += cal.getActualMaximum(Calendar.DAY_OF_MONTH);
                } else if (currentMonth == Calendar.SEPTEMBER) {
                    cal.set(2, Calendar.SEPTEMBER);
                    daysToAdd += cal.getActualMaximum(Calendar.DAY_OF_MONTH);
                } else if (currentMonth == Calendar.OCTOBER) {
                    cal.set(2, Calendar.OCTOBER);
                    daysToAdd += cal.getActualMaximum(Calendar.DAY_OF_MONTH);
                } else if (currentMonth == Calendar.NOVEMBER) {
                    cal.set(2, Calendar.NOVEMBER);
                    daysToAdd += cal.getActualMaximum(Calendar.DAY_OF_MONTH);
                } else if (currentMonth == Calendar.DECEMBER) {
                    cal.set(2, Calendar.DECEMBER);
                    daysToAdd += cal.getActualMaximum(Calendar.DAY_OF_MONTH);
                }
                currentMonth++;
            } else {
                currentMonth = 0;
                i--;
            }
        }
    }
    daysToAdd += day;
    // add the desired number of days to the long value using milli seconds

    t += daysToAdd * MILLIS_PER_DAY;
    cal.setTime(new Date(t));
    // and now you can format the date the way you want
    String result = Integer.toString(cal.get(Calendar.DAY_OF_MONTH)) + "-"
            + Integer.toString(cal.get(Calendar.MONTH) + 1) + "-" + Integer.toString(cal.get(Calendar.YEAR));
    System.out.println("result month add::" + result);
    return cal;
}

From source file:org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_9.EncounterController1_9Test.java

@Test
public void createEncounter_shouldCreateANewEncounterWithObs() throws Exception {
    long before = getAllCount();
    Util.log("before = ", before);

    SimpleObject post = createEncounterWithObs();

    MockHttpServletResponse response = handle(newPostRequest(getURI(), post));
    SimpleObject newEncounter = deserialize(response);

    Assert.assertNotNull(newEncounter);//w  w  w  .  ja v a  2 s.c  om
    Util.log("after = ", getAllCount());
    Assert.assertEquals(before + 1, getAllCount());

    Util.log("created encounter with obs", newEncounter);
    @SuppressWarnings("unchecked")
    List<Map<String, String>> obs = (List<Map<String, String>>) newEncounter.get("obs");

    Assert.assertEquals(4, obs.size());
    Set<String> obsDisplayValues = new HashSet<String>();
    for (Map<String, String> o : obs) {
        obsDisplayValues.add(o.get("display"));
    }
    Assert.assertTrue(obsDisplayValues.contains("CIVIL STATUS: MARRIED"));
    Assert.assertTrue(obsDisplayValues.contains("FAVORITE FOOD, NON-CODED: fried chicken"));
    Assert.assertTrue(obsDisplayValues.contains("WEIGHT (KG): 70.0"));

    // obs.getValueAsString() uses application Locale and hence have to do this
    Calendar cal = Calendar.getInstance();
    cal.set(2011, Calendar.JUNE, 21, 0, 0, 0);
    String format = Format.format(cal.getTime(), Context.getLocale(), FORMAT_TYPE.TIMESTAMP);
    Assert.assertTrue(obsDisplayValues.contains("DATE OF FOOD ASSISTANCE: " + format));
}

From source file:org.kuali.kfs.module.endow.businessobject.lookup.CalculateProcessDateUsingFrequencyCodeService.java

/**
 * This method will check the current month and set the calendar to that month
 * @param month month to set the calendar
 * @return calendar calendar is set to the month selected
 *//*w w  w .  j  av a 2  s.  co m*/
protected Calendar setCaledarWithMonth(String month, Date currentDate) {
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(currentDate);
    int calendarMonth = 1;

    if (EndowConstants.FrequencyMonths.JANUARY.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.JANUARY;
    } else if (EndowConstants.FrequencyMonths.FEBRUARY.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.FEBRUARY;
    } else if (EndowConstants.FrequencyMonths.MARCH.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.MARCH;
    } else if (EndowConstants.FrequencyMonths.APRIL.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.APRIL;
    } else if (EndowConstants.FrequencyMonths.MAY.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.MAY;
    } else if (EndowConstants.FrequencyMonths.JUNE.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.JUNE;
    } else if (EndowConstants.FrequencyMonths.JULY.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.JULY;
    } else if (EndowConstants.FrequencyMonths.AUGUST.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.AUGUST;
    } else if (EndowConstants.FrequencyMonths.SEPTEMBER.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.SEPTEMBER;
    } else if (EndowConstants.FrequencyMonths.OCTOBER.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.OCTOBER;
    } else if (EndowConstants.FrequencyMonths.NOVEMBER.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.NOVEMBER;
    } else if (EndowConstants.FrequencyMonths.DECEMBER.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.DECEMBER;
    }

    calendar.set(Calendar.MONTH, calendarMonth);

    return calendar;
}

From source file:net.sourceforge.fenixedu.presentationTier.TagLib.sop.examsMapNew.renderers.ExamsMapContentRenderer.java

private String monthToString(int month, Locale locale) {
    switch (month) {

    case Calendar.JANUARY:
        if (locale.getLanguage().equals("pt")) {
            return "Janeiro";
        }/*from w  ww.j  av  a  2 s .  c  om*/
        return "January";
    case Calendar.FEBRUARY:
        if (locale.getLanguage().equals("pt")) {
            return "Fevereiro";
        }
        return "February";
    case Calendar.MARCH:
        if (locale.getLanguage().equals("pt")) {
            return "Maro";
        }
        return "March";
    case Calendar.APRIL:
        if (locale.getLanguage().equals("pt")) {
            return "Abril";
        }
        return "April";
    case Calendar.MAY:
        if (locale.getLanguage().equals("pt")) {
            return "Maio";
        }
        return "May";
    case Calendar.JUNE:
        if (locale.getLanguage().equals("pt")) {
            return "Junho";
        }
        return "June";
    case Calendar.JULY:
        if (locale.getLanguage().equals("pt")) {
            return "Julho";
        }
        return "July";
    case Calendar.AUGUST:
        if (locale.getLanguage().equals("pt")) {
            return "Agosto";
        }
        return "August";
    case Calendar.SEPTEMBER:
        if (locale.getLanguage().equals("pt")) {
            return "Setembro";
        }
        return "September";
    case Calendar.OCTOBER:
        if (locale.getLanguage().equals("pt")) {
            return "Outubro";
        }
        return "October";
    case Calendar.NOVEMBER:
        if (locale.getLanguage().equals("pt")) {
            return "Novembro";
        }
        return "November";
    case Calendar.DECEMBER:
        if (locale.getLanguage().equals("pt")) {
            return "Dezembro";
        }
        return "December";
    case Calendar.UNDECIMBER:
        return "Undecember";
    default:
        return "Error";
    }
}

From source file:org.kuali.kra.award.AwardVersioningTest.java

private AwardFandaRate createAwardFandaRate(String onOffCampusFlag) {
    AwardFandaRate rate = new AwardFandaRate();
    rate.setApplicableFandaRate(new ScaleTwoDecimal(5.0));
    rate.setFandaRateTypeCode("1");
    rate.setFiscalYear("2008");
    rate.setStartDate(new Date(new GregorianCalendar(2007, Calendar.JULY, 1).getTimeInMillis()));
    rate.setStartDate(new Date(new GregorianCalendar(2008, Calendar.JUNE, 30).getTimeInMillis()));
    rate.setOnCampusFlag(onOffCampusFlag);
    return rate;//from ww w .  jav a  2  s.  c o m
}

From source file:org.kuali.kfs.module.endow.document.service.impl.FrequencyDatesServiceImpl.java

/**
 * This method will check the current month and set the calendar to that month
 * @param month month to set the calendar
 * @return calendar calendar is set to the month selected
 *//*from www. ja  v  a 2 s.  c  om*/
protected Calendar setCalendarWithMonth(String month, Date currentDate) {
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(currentDate);
    int calendarMonth = Calendar.JANUARY;

    if (EndowConstants.FrequencyMonths.JANUARY.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.JANUARY;
    } else if (EndowConstants.FrequencyMonths.FEBRUARY.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.FEBRUARY;
    } else if (EndowConstants.FrequencyMonths.MARCH.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.MARCH;
    } else if (EndowConstants.FrequencyMonths.APRIL.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.APRIL;
    } else if (EndowConstants.FrequencyMonths.MAY.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.MAY;
    } else if (EndowConstants.FrequencyMonths.JUNE.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.JUNE;
    } else if (EndowConstants.FrequencyMonths.JULY.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.JULY;
    } else if (EndowConstants.FrequencyMonths.AUGUST.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.AUGUST;
    } else if (EndowConstants.FrequencyMonths.SEPTEMBER.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.SEPTEMBER;
    } else if (EndowConstants.FrequencyMonths.OCTOBER.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.OCTOBER;
    } else if (EndowConstants.FrequencyMonths.NOVEMBER.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.NOVEMBER;
    } else if (EndowConstants.FrequencyMonths.DECEMBER.equalsIgnoreCase(month)) {
        calendarMonth = Calendar.DECEMBER;
    }

    calendar.set(Calendar.MONTH, calendarMonth);

    return calendar;
}

From source file:org.kuali.kfs.module.endow.businessobject.lookup.CalculateProcessDateUsingFrequencyCodeService.java

/**
 * This method will check the current month and set the calendar to that month
 * @param month, dayOfMonth month to set the calendar, dayOfMonth day of the month to set to
 * @return calendar calendar is set to the month selected
 *///www. jav  a 2 s  .co  m
protected void setCalendarWithDays(Calendar calendar, String dayOfMonth) {
    int dayInMonthToSet;
    int calendarMonth = calendar.get(Calendar.MONTH);

    if (StringUtils.equalsIgnoreCase(dayOfMonth, EndowConstants.FrequencyMonthly.MONTH_END)) { // month end for the month so need to get max days...
        dayInMonthToSet = checkMaximumDaysInMonth(calendar.get(Calendar.MONTH));
    } else {
        dayInMonthToSet = Integer.parseInt(dayOfMonth);

        if (dayInMonthToSet > 29 && calendarMonth == Calendar.FEBRUARY) {
            dayInMonthToSet = checkMaximumDaysInFebruary();
        } else if (dayInMonthToSet > 30 && (calendarMonth == Calendar.APRIL || calendarMonth == Calendar.JUNE
                || calendarMonth == Calendar.SEPTEMBER || calendarMonth == Calendar.NOVEMBER)) {
            dayInMonthToSet = 30;
            dayInMonthToSet = checkMaximumDaysInMonth(calendarMonth);
        }
    }

    calendar.set(Calendar.DAY_OF_MONTH, dayInMonthToSet);
}