Example usage for java.util Calendar DAY_OF_MONTH

List of usage examples for java.util Calendar DAY_OF_MONTH

Introduction

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

Prototype

int DAY_OF_MONTH

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

Click Source Link

Document

Field number for get and set indicating the day of the month.

Usage

From source file:net.ceos.project.poi.annotated.bean.cascade.CascadeL2Builder.java

/**
 * Validate the CascadeL2 based on the object build with the method
 * 'buildCascadeL2'//w w w.  jav a2s  .co m
 * 
 * @param toValidate
 *            the object to validate
 */
public static void validateCascadeL2(CascadeL2 toValidate) {
    CascadeL2 base = buildCascadeL2();

    Calendar calendar = Calendar.getInstance();
    calendar.setTime(new Date());

    Calendar calendarUnmarshal = Calendar.getInstance();
    calendarUnmarshal.setTime(toValidate.getDateAttribute());
    assertEquals(calendar.get(Calendar.YEAR), calendarUnmarshal.get(Calendar.YEAR));
    assertEquals(calendar.get(Calendar.MONTH), calendarUnmarshal.get(Calendar.MONTH));
    assertEquals(calendar.get(Calendar.DAY_OF_MONTH), calendarUnmarshal.get(Calendar.DAY_OF_MONTH));

    assertEquals(base.getStringAttribute(), toValidate.getStringAttribute());
    assertEquals(base.getIntegerAttribute(), toValidate.getIntegerAttribute());
    assertEquals(base.getDoubleAttribute(), toValidate.getDoubleAttribute());
    assertEquals(base.getLongAttribute(), toValidate.getLongAttribute());
    assertEquals(base.getBooleanAttribute(), toValidate.getBooleanAttribute());
    assertEquals(base.getJob().getJobCode(), toValidate.getJob().getJobCode());
    assertEquals(base.getJob().getJobFamily(), toValidate.getJob().getJobFamily());
    assertEquals(base.getJob().getJobName(), toValidate.getJob().getJobName());

    // TODO add new validation below
}

From source file:org.spring.data.gemfire.cache.SpringGemfireTemplateTests.java

protected Date createDate(final int year, final int month, final int dayOfMonth) {
    Calendar date = Calendar.getInstance();

    date.clear();/*from   w  ww .ja  va  2  s  . com*/
    date.set(Calendar.YEAR, year);
    date.set(Calendar.MONTH, month);
    date.set(Calendar.DAY_OF_MONTH, dayOfMonth);

    return date.getTime();
}

From source file:net.ceos.project.poi.annotated.bean.cascade.CascadeL1Builder.java

/**
 * Validate the CascadeL1 based on the object build with the method
 * 'buildCascadeL1'//from  w  w  w  .j  ava 2 s. co  m
 * 
 * @param toValidate
 *            the object to validate
 */
public static void validateCascadeL1(CascadeL1 toValidate) {
    CascadeL1 base = buildCascadeL1();

    Calendar calendar = Calendar.getInstance();
    calendar.setTime(new Date());

    Calendar calendarUnmarshal = Calendar.getInstance();
    calendarUnmarshal.setTime(toValidate.getDateAttribute());
    assertEquals(calendar.get(Calendar.YEAR), calendarUnmarshal.get(Calendar.YEAR));
    assertEquals(calendar.get(Calendar.MONTH), calendarUnmarshal.get(Calendar.MONTH));
    assertEquals(calendar.get(Calendar.DAY_OF_MONTH), calendarUnmarshal.get(Calendar.DAY_OF_MONTH));

    assertEquals(base.getStringAttribute(), toValidate.getStringAttribute());
    assertEquals(base.getIntegerAttribute(), toValidate.getIntegerAttribute());
    assertEquals(base.getDoubleAttribute(), toValidate.getDoubleAttribute());
    assertEquals(base.getLongAttribute(), toValidate.getLongAttribute());
    assertEquals(base.getBooleanAttribute(), toValidate.getBooleanAttribute());
    assertEquals(base.getJob().getJobCode(), toValidate.getJob().getJobCode());
    assertEquals(base.getJob().getJobFamily(), toValidate.getJob().getJobFamily());
    assertEquals(base.getJob().getJobName(), toValidate.getJob().getJobName());

    // TODO add new validation below
}

From source file:net.ceos.project.poi.annotated.bean.ConditionalFormatObjectBuilder.java

/**
 * Validate the ConditionalFormatObject based on the object build with the method
 * 'buildConditionalFormatObject'//w  ww  .jav  a 2 s  .c om
 * 
 * @param toValidate
 *            the object to validate
 */
public static void validateConditionalFormatObject(ConditionalFormatObject toValidate) {
    ConditionalFormatObject base = buildConditionalFormatObject();

    Calendar calendar = Calendar.getInstance();
    calendar.setTime(new Date());

    Calendar calendarUnmarshal = Calendar.getInstance();
    calendarUnmarshal.setTime(toValidate.getDateAttribute());
    assertEquals(calendar.get(Calendar.YEAR), calendarUnmarshal.get(Calendar.YEAR));
    assertEquals(calendar.get(Calendar.MONTH), calendarUnmarshal.get(Calendar.MONTH));
    assertEquals(calendar.get(Calendar.DAY_OF_MONTH), calendarUnmarshal.get(Calendar.DAY_OF_MONTH));

    assertEquals(base.getStringAttribute(), toValidate.getStringAttribute());
    assertEquals(base.getIntegerAttribute(), toValidate.getIntegerAttribute());
    assertEquals(base.getDoubleAttribute(), toValidate.getDoubleAttribute());
    assertEquals(base.getLongAttribute(), toValidate.getLongAttribute());
    assertEquals(base.getBooleanAttribute(), toValidate.getBooleanAttribute());
    assertEquals(base.getJob().getJobCode(), toValidate.getJob().getJobCode());
    assertEquals(base.getJob().getJobFamily(), toValidate.getJob().getJobFamily());
    assertEquals(base.getJob().getJobName(), toValidate.getJob().getJobName());
}

From source file:model.service.ServiceEmployee.java

@Transactional(readOnly = true)
public List<Temployee> listExpirationCertificate() {
    Calendar date = Calendar.getInstance();
    /* Sumamos 30 dias al dia actual */
    date.add(Calendar.DAY_OF_MONTH, 30);
    Date dateFuture = date.getTime();
    List<Temployee> list = daoEmployee.listUpcomingDatesActive("dateCertificate", dateFuture);
    return list;//from   ww  w  . jav  a2 s. c  o m
}

From source file:com.evolveum.midpoint.repo.sql.CleanupTest.java

License:asdf

private Calendar create_2013_07_12_12_00_Calendar() {
    Calendar calendar = Calendar.getInstance();
    calendar.set(Calendar.YEAR, 2013);
    calendar.set(Calendar.MONTH, Calendar.MAY);
    calendar.set(Calendar.DAY_OF_MONTH, 7);
    calendar.set(Calendar.HOUR_OF_DAY, 12);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    calendar.set(Calendar.MILLISECOND, 0);

    return calendar;
}

From source file:org.openmrs.module.patientregistration.controller.workflow.PrimaryCareReceptionEncounterControllerTest.java

@Test
public void processPayment_shouldCreateVisitAndCheckInPatient() throws Exception {
    Patient patient = Context.getPatientService().getPatient(7);
    String listOfObs = "[{CODED,2002,Medical certificate without diagnosis,1000,0;NUMERIC,0,50 Gourdes,1001,0;NON-CODED,0,12345,1002,0;}"
            + ", {CODED,2001,Standard outpatient visit,1000,0;NUMERIC,0,100 Gourdes,1001,0;NON-CODED,0,98765,1002,0;}]";

    PrimaryCareReceptionEncounterController controller = new PrimaryCareReceptionEncounterController();
    controller.setAdtService(Context.getService(AdtService.class));
    controller.setEmrProperties(emrProperties);

    Calendar now = Calendar.getInstance();
    String year = "" + now.get(Calendar.YEAR);
    String month = "" + (1 + now.get(Calendar.MONTH));
    String day = "" + now.get(Calendar.DAY_OF_MONTH);

    ModelAndView modelAndView = controller.processPayment(patient, listOfObs, false, year, month, day, false,
            null, null, session, new ExtendedModelMap());

    Visit activeVisit = Context.getService(AdtService.class)
            .getActiveVisit(patient, PatientRegistrationWebUtil.getRegistrationLocation(session)).getVisit();

    assertNotNull(activeVisit);//from w ww .j  av  a 2 s. co m
    assertThat(activeVisit.getEncounters().size(), is(1));
    assertThat(activeVisit.getEncounters().iterator().next().getEncounterType(),
            is(PatientRegistrationGlobalProperties.GLOBAL_PROPERTY_PRIMARY_CARE_RECEPTION_ENCOUNTER_TYPE()));
}

From source file:mobile.tiis.appv2.helpers.Utils.java

public static DatePickerDialog.OnDateSetListener defaultOnDateSetListener(final EditText editText) {
    return new DatePickerDialog.OnDateSetListener() {

        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            Calendar c = Calendar.getInstance();
            c.set(Calendar.YEAR, year);
            c.set(Calendar.MONTH, monthOfYear);
            c.set(Calendar.DAY_OF_MONTH, dayOfMonth);

            SimpleDateFormat dateFormat = new SimpleDateFormat(DEFAULT_DATE_PATTERN);
            editText.setText(dateFormat.format(c.getTime()));
        }/*w  ww.  ja va2 s. c  o  m*/
    };
}

From source file:com.silverpeas.calendar.DateTimeTest.java

@Test
public void createsAtASpecifiedDateTime() {
    Calendar now = getInstance();
    DateTime expected = new DateTime(now.getTime());
    DateTime actual = DateTime.dateTimeAt(now.get((Calendar.YEAR)), now.get(Calendar.MONTH),
            now.get(Calendar.DAY_OF_MONTH), now.get(Calendar.HOUR_OF_DAY), now.get(Calendar.MINUTE),
            now.get(Calendar.SECOND), now.get(Calendar.MILLISECOND));
    assertEquals(expected.getTime(), actual.getTime(), 100);
}

From source file:com.haw3d.jadvalKalemat.net.NYTDownloader.java

@Override
protected String createUrlSuffix(Calendar date) {
    return (date.get(Calendar.YEAR) + "/" + DEFAULT_NF.format(date.get(Calendar.MONTH) + 1) + "/"
            + DEFAULT_NF.format(date.get(Calendar.DAY_OF_MONTH)) + "/" + SHORT_MONTHS[date.get(Calendar.MONTH)]
            + DEFAULT_NF.format(date.get(Calendar.DAY_OF_MONTH))
            + DEFAULT_NF.format(date.get(Calendar.YEAR) % 100) + ".puz");
}