Example usage for java.util Date setHours

List of usage examples for java.util Date setHours

Introduction

In this page you can find the example usage for java.util Date setHours.

Prototype

@Deprecated
public void setHours(int hours) 

Source Link

Document

Sets the hour of this Date object to the specified value.

Usage

From source file:cn.ipanel.apps.portalBackOffice.util.CommonsFiend.java

public static String[] getUpdateTime() {
    Date date = Calendar.getInstance().getTime();
    date.setMinutes(date.getMinutes() + 1);
    String[] returnTime = new String[2];
    returnTime[0] = DateFormatUtils.format(date, Defines.FORMAT_DATE_TIME_STRING);
    date.setHours(23);
    date.setMinutes(59);/*from  www . j a  va  2  s  .c  o m*/
    date.setSeconds(59);
    returnTime[1] = DateFormatUtils.format(date, Defines.FORMAT_DATE_TIME_STRING);
    return returnTime;
}

From source file:org.teleportr.plugin.BahnDePlugIn.java

private Date parseDate(String hours, String minutes) {
    Date date = new Date();
    date.setHours(Integer.parseInt(hours));
    date.setMinutes(Integer.parseInt(minutes));
    date.setSeconds(0);/* w w  w.  j av a  2s .  c  o m*/
    //date.setTime((date.getTime() / 1000) * 1000);
    if (System.currentTimeMillis() - date.getTime() > 300000) { // Mitternacht..
        long oneDay = (long) 1000.0 * 60 * 60 * 24;
        date.setTime(date.getTime() + oneDay);
    }
    return date;
}

From source file:th.co.geniustree.dental.controller.AppointmentController.java

@RequestMapping(value = "/appointnontification", method = RequestMethod.GET)
private Page<Appointment> getAppointmentNontification(Pageable pageable) {
    Date d = new Date();
    d.setHours(0);
    d.setMinutes(0);/*w  w  w .  j av a 2s. c  om*/
    Date tomorrow = new Date(d.getTime() + (60 * 60 * 24 * 1000));
    return appointmentRepo.findByAppointDay(tomorrow, pageable);
}

From source file:br.com.hslife.orcamento.service.AgendaService.java

@SuppressWarnings("deprecation")
@Override//from www.  j  ava  2s.c o  m
public Long contarAgendamentosDeHojeComAlerta() {
    Date inicio = new Date();
    inicio.setHours(0);
    inicio.setMinutes(0);
    inicio.setSeconds(0);

    Date fim = new Date(inicio.getTime());
    fim.setHours(23);
    fim.setMinutes(59);
    fim.setSeconds(59);
    return getRepository().countAgendamentoByDataInicioOrDataFimAndAlerta(inicio, fim, true,
            getUsuarioComponent().getUsuarioLogado());
}

From source file:th.co.geniustree.dental.controller.AppointmentController.java

@RequestMapping(value = "/appointmentnontificationcountnotcontact", method = RequestMethod.GET)
private Long appointmentNontificationCountNotContact() {
    Date d = new Date();
    d.setHours(0);
    d.setMinutes(0);/*  www .  j av a  2  s .  c o m*/
    Date tomorrow = new Date(d.getTime() + (60 * 60 * 24 * 1000));
    long count = 0;
    count = appointmentRepo.findByAppointDayAndStatus(tomorrow, "1").size();
    return count;
}

From source file:br.com.hslife.orcamento.service.AgendaService.java

@SuppressWarnings("deprecation")
public List<Agenda> buscarAgendamentosDoDia() {
    CriterioAgendamento criterioBusca = new CriterioAgendamento();
    Date inicio = new Date();
    inicio.setHours(0);
    inicio.setMinutes(0);/*from  w w w .  jav  a 2 s  .c o  m*/
    inicio.setSeconds(0);

    Date fim = new Date(inicio.getTime());
    fim.setHours(23);
    fim.setMinutes(59);
    fim.setSeconds(59);
    criterioBusca.setInicio(inicio);
    criterioBusca.setFim(fim);
    criterioBusca.setUsuario(getUsuarioComponent().getUsuarioLogado());
    return getRepository().findByCriterioAgendamento(criterioBusca);
}

From source file:th.co.geniustree.dental.controller.AppointmentController.java

@RequestMapping(value = "/appointmentnontificationcount", method = RequestMethod.GET)
private Long appointmentNontificationCount(Pageable pageable) {
    Date d = new Date();
    d.setHours(0);
    d.setMinutes(0);/*w  w w.  j a  v  a2  s. c om*/
    Date tomorrow = new Date(d.getTime() + (60 * 60 * 24 * 1000));
    long count = 0;
    count = appointmentRepo.findByAppointDayAndStatus(tomorrow, "1").size();

    //        List<Appointment> listAppointment = appointmentRepo.findByStatus("2");
    //        for (int i = 0; i < listAppointment.size(); i++) {
    //            Appointment appointment = new Appointment();
    //            appointment = listAppointment.get(i);
    //            SimpleDateFormat dateFormat = new SimpleDateFormat("D");
    //            if (((Integer.parseInt(dateFormat.format(appointment.getAppointDay())) - Integer.parseInt(dateFormat.format(new Date()))) == 1) && ((!"0".equals(appointment.getStatus())))) {
    //                appointment.setStatus("1");
    //                appointmentRepo.save(appointment);
    //                count++;
    //            } else {
    //                appointment.setStatus("2");
    //                appointmentRepo.save(appointment);
    //            }
    //        }
    return count;
}

From source file:org.apache.hadoop.hive.ql.udf.UDFNextDay.java

public String evaluate(String date, Integer day) {
    if (date == null || day == null) {
        return null;
    }/*from  w w w  .  ja  va2 s . c o  m*/

    if (day < 1 || day > 7) {
        return null;
    }

    Pattern pattern = Pattern.compile("([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])[\\s\\S]*(\\..*)?$");

    Matcher matcher = pattern.matcher(date);

    if (!matcher.matches()) {
        return null;
    }

    int year = Integer.valueOf(matcher.group(1));
    int month = Integer.valueOf(matcher.group(2));
    int dd = Integer.valueOf(matcher.group(3));

    Date ret = new Date();
    ret.setYear(year - 1900);
    ret.setMonth(month - 1);
    ret.setDate(dd);

    ret.setHours(0);
    ret.setMinutes(0);
    ret.setSeconds(0);

    Calendar curr = Calendar.getInstance();
    curr.setTime(ret);

    int curr_week = curr.get(Calendar.DAY_OF_WEEK);
    int offset = 7 + (day - curr_week);

    curr.add(Calendar.DAY_OF_WEEK, offset);

    Date newDate = curr.getTime();
    System.out.println("newDate:" + newDate.toString());

    year = curr.get(Calendar.YEAR);
    month = curr.get(Calendar.MONTH) + 1;
    dd = curr.get(Calendar.DAY_OF_MONTH);

    System.out.println("curr.get(Calendar.MONTH):" + curr.get(Calendar.MONTH));

    return String.format("%04d-%02d-%02d", year, month, dd);
}

From source file:v2.ClientTest.java

@Test
public void testDatesLaptop() throws APIException {
    Laptop laptop = new Laptop();
    laptop.setStatus(Laptop.TAGGED_S0);//  ww w  . j  ava2 s . co  m
    Date dateDelivered = new Date();
    dateDelivered.setHours(12);
    dateDelivered.setMinutes(45);
    dateDelivered.setSeconds(10);

    dateDelivered.setMonth(3);
    dateDelivered.setYear(2012);

    laptop.setDateDelivered(dateDelivered);
    Date dateReceived = new Date();
    dateReceived.setHours(1);
    dateReceived.setMinutes(41);
    dateReceived.setSeconds(10);
    dateReceived.setMonth(5);
    dateReceived.setYear(2012);
    laptop.setDateReceived(dateReceived);

    Date dateRecycled = new Date();
    dateRecycled.setHours(1);
    dateRecycled.setMinutes(35);
    dateRecycled.setSeconds(10);
    dateRecycled.setMonth(4);
    dateRecycled.setYear(2012);
    laptop.setDateRecycled(dateRecycled);
    String nid = client.addLaptop(laptop);

    // Check date laptop

    // Laptop laptop = client.getLaptop(nid);
    // log.info(laptop);
    // log.info("Response test: "+nid);
    boolean result = client.deleteLaptop(nid);
    // log.info("It was deleted: "+result);
    Assert.assertTrue(result);

}

From source file:com.android.applications.todoist.containers.Tasks.java

public ArrayList<Task> getOverdueTasks() {
    ArrayList<Task> list = new ArrayList<Task>();
    int size = this.tasks.size();
    Date today = new Date();
    today.setSeconds(0);/*  w  w  w .j  ava 2 s .c  o m*/
    today.setMinutes(0);
    today.setHours(0);

    for (int i = 0; i < size; i++) {
        if (this.tasks.get(i).getDueDate().before(today)) {
            list.add(this.tasks.get(i));
        }
    }

    return list;
}