Example usage for java.util GregorianCalendar getTime

List of usage examples for java.util GregorianCalendar getTime

Introduction

In this page you can find the example usage for java.util GregorianCalendar getTime.

Prototype

public final Date getTime() 

Source Link

Document

Returns a Date object representing this Calendar's time value (millisecond offset from the Epoch").

Usage

From source file:RandomFileTest.java

/**
   Reads employee data from a data input
   @param in the data input//from ww  w . j a v  a 2  s  .c o  m
*/
public void readData(DataInput in) throws IOException {
    name = DataIO.readFixedString(NAME_SIZE, in);
    salary = in.readDouble();
    int y = in.readInt();
    int m = in.readInt();
    int d = in.readInt();
    GregorianCalendar calendar = new GregorianCalendar(y, m - 1, d);
    hireDay = calendar.getTime();
}

From source file:org.talend.designer.core.generic.model.migration.NewSalesforceMigrationTask.java

@Override
public Date getOrder() {
    GregorianCalendar gc = new GregorianCalendar(2016, 04, 18, 12, 0, 0);
    return gc.getTime();
}

From source file:org.talend.updates.runtime.login.InstallLocalNexusComponentsLoginTask.java

@Override
public Date getOrder() {
    GregorianCalendar gc = new GregorianCalendar(2017, 6, 7, 12, 0, 0);
    return gc.getTime();
}

From source file:TestReservasSalas.java

@Test
public void testDisponibilidadSala() throws OperationFailedException {
    Establecimiento e = new Establecimiento(1, "El toque", "123.456.789-1", "calle falsa 123", new Time(700),
            new Time(1900), 0, "Usaquen", "1234567", "34301293809213820921");
    logica.registrarEstablecimiento(e);/*w  w w .j  a v  a2  s .  c o  m*/
    Sala s = new Sala(1, logica.consultarEstablecimiento(1), "1000", "Sala de Orcas");
    logica.registrarSala(s);
    Date d = new Date();
    GregorianCalendar gc = new GregorianCalendar();
    gc.setTime(d);
    Time t = new Time(gc.getTime().getTime());

    assertTrue(logica.verificarDisponibilidadSala(d, t, s.getIdSala(), 1));

    Reservacion r = new Reservacion(1, s, d, t, 1);
    //s.getReservacions().add(r);
    String resp = logica.registrarReserva(e.getIdEstablecimiento(), s.getIdSala(), d, t, 2);

    assertFalse(logica.verificarDisponibilidadSala(d, t, s.getIdSala(), 1));
    List<Reservacion> l = logica.consultarReservacionesPorSala(s.getIdSala());
    System.out.println(l.get(0).getFecha().toString());

    Cliente c = new Cliente(1016040342, "ORCA");
    logica.registrarCliente(c);

    for (Reservacion rs : l) {
        if (rs.getFecha().equals(r.getFecha()))
            r = rs;
    }
    r.setIdReservacion(0);
    if (resp.equals("0"))
        logica.crearEnsayoAlquiler(c.getIdCliente(), r, "ensayaremos mucho");

}

From source file:org.talend.esb.sam.server.persistence.EventRepositoryTest.java

@Test
public void testWriteEvent() {
    GregorianCalendar cal = new GregorianCalendar(2000, Calendar.JANUARY, 1, 01, 01, 10);

    Event event = EventCreator.createEvent("content", cal.getTime(), EventTypeEnum.REQ_IN, "orig_id",
            "localhost", "10.0.0.1", "1", "2", "3", "operation", "service", "http");
    event.getCustomInfo().put("mykey1", "myValue1");
    event.getCustomInfo().put("mykey2", "myValue2");

    Assert.assertNull(event.getPersistedId());
    eventRepository.writeEvent(event);//www  .  j  a va 2 s.  co m
    Assert.assertNotNull(event.getPersistedId());

    //read Event from database
    Event readEvent = eventRepository.readEvent(event.getPersistedId().longValue());
    Assert.assertTrue(EqualsBuilder.reflectionEquals(event, readEvent));

}

From source file:org.openvpms.archetype.rules.util.DateRules.java

/**
 * Calculates a date given a start time, interval and the date units.
 *
 * @param startTime the start time//from  w w  w. j  a va 2 s  . c  o  m
 * @param interval  the time interval. May be negative to calculate a date in the past
 * @param units     the interval units
 * @return the date
 */
public static Date getDate(Date startTime, int interval, DateUnits units) {
    GregorianCalendar calendar = new GregorianCalendar();
    calendar.setTime(startTime);
    if (units != null) {
        switch (units) {
        case YEARS:
            calendar.add(Calendar.YEAR, interval);
            break;
        case MONTHS:
            calendar.add(Calendar.MONTH, interval);
            break;
        case WEEKS:
            calendar.add(Calendar.DAY_OF_YEAR, interval * 7);
            break;
        case DAYS:
            calendar.add(Calendar.DAY_OF_YEAR, interval);
            break;
        case HOURS:
            calendar.add(Calendar.HOUR_OF_DAY, interval);
            break;
        case MINUTES:
            calendar.add(Calendar.MINUTE, interval);
            break;
        }
    }
    return calendar.getTime();
}

From source file:de.escoand.readdaily.EndlessContentPager.java

private Date getDateOfPosition(final int position) {
    final GregorianCalendar calendar = new GregorianCalendar();
    calendar.add(Calendar.DATE, position - POSITIONS_INTIAL);
    return calendar.getTime();
}

From source file:it.cilea.osd.jdyna.widget.WidgetDate.java

public long toMilliSeconds(int anno, int mese, int giorno) {

    GregorianCalendar data = new GregorianCalendar(anno, mese, giorno);
    Date d1 = data.getTime();
    long l1 = d1.getTime();

    return l1;/*  w  w w . j  a  va2 s .  c  om*/

}

From source file:PairTest3.java

public Employee(String n, double s, int year, int month, int day) {
    name = n;//from w w w.  jav  a  2s .c  om
    salary = s;
    GregorianCalendar calendar = new GregorianCalendar(year, month - 1, day);
    hireDay = calendar.getTime();
}

From source file:org.jbpm.formModeler.core.processing.formProcessing.Functions.java

public Date getDateFromFields(String sDay, String sMonth, String sYear) {
    int day = Integer.decode(sDay).intValue();
    int month = Integer.decode(sMonth).intValue();
    int year = Integer.decode(sYear).intValue();
    GregorianCalendar gc = new GregorianCalendar(year, month, day);
    return gc.getTime();
}