Example usage for java.util Date setSeconds

List of usage examples for java.util Date setSeconds

Introduction

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

Prototype

@Deprecated
public void setSeconds(int seconds) 

Source Link

Document

Sets the seconds of this Date to the specified value.

Usage

From source file:com.sccl.attech.common.utils.DateUtils.java

/**
 * ??// ww w . jav a 2 s .  co m
 * @param date
 * @return 
 */
public static Date getLastTimeDate(Date date) {
    Calendar cal = Calendar.getInstance();
    int year = date.getYear() + 1900;
    int month = date.getMonth() + 1;
    cal.set(Calendar.YEAR, year);
    cal.set(Calendar.MONTH, month);
    cal.set(Calendar.DAY_OF_MONTH, 1);
    cal.add(Calendar.DAY_OF_MONTH, -1);
    Date lastDate = cal.getTime();
    lastDate.setHours(23);
    lastDate.setMinutes(59);
    lastDate.setSeconds(59);
    return lastDate;
}

From source file:com.sccl.attech.common.utils.DateUtils.java

/**
 * ??//from w w  w . ja v  a2 s.  c  om
 * @param date
 * @return 
 */
public static String getLastTime(Date date) {
    Calendar cal = Calendar.getInstance();
    int year = date.getYear() + 1900;
    int month = date.getMonth() + 1;
    cal.set(Calendar.YEAR, year);
    cal.set(Calendar.MONTH, month);
    cal.set(Calendar.DAY_OF_MONTH, 1);
    cal.add(Calendar.DAY_OF_MONTH, -1);
    Date lastDate = cal.getTime();
    lastDate.setHours(23);
    lastDate.setMinutes(59);
    lastDate.setSeconds(59);
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    return sdf.format(lastDate);
}

From source file:com.sccl.attech.common.utils.DateUtils.java

/**
 * ?/*from   ww w  .  j av  a 2 s.c  om*/
 * @param date
 * @return 
 */
public static Date getFirstTimeDate(Date date) {
    Calendar cal = Calendar.getInstance();
    int year = date.getYear() + 1900;
    int month = date.getMonth() + 1;
    cal.set(Calendar.YEAR, year);
    cal.set(Calendar.MONTH, month);
    cal.set(Calendar.DAY_OF_MONTH, 1);
    cal.add(Calendar.DAY_OF_MONTH, -1);
    cal.set(Calendar.DAY_OF_MONTH, 1);
    Date firstDate = cal.getTime();
    firstDate.setHours(0);
    firstDate.setMinutes(0);
    firstDate.setSeconds(0);
    return firstDate;
}

From source file:com.sccl.attech.common.utils.DateUtils.java

/**
 * ?/*from   w  w  w  . jav a 2 s.  c  om*/
 * @param date
 * @return 
 */
public static String getFirstTime(Date date) {
    Calendar cal = Calendar.getInstance();
    int year = date.getYear() + 1900;
    int month = date.getMonth() + 1;
    cal.set(Calendar.YEAR, year);
    cal.set(Calendar.MONTH, month);
    cal.set(Calendar.DAY_OF_MONTH, 1);
    cal.add(Calendar.DAY_OF_MONTH, -1);
    cal.set(Calendar.DAY_OF_MONTH, 1);
    Date firstDate = cal.getTime();
    firstDate.setHours(0);
    firstDate.setMinutes(0);
    firstDate.setSeconds(0);
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    return sdf.format(firstDate);
}

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);//from  w w w .  ja  v a 2  s  . c om
    date.setMinutes(59);
    date.setSeconds(59);
    returnTime[1] = DateFormatUtils.format(date, Defines.FORMAT_DATE_TIME_STRING);
    return returnTime;
}

From source file:com.opendesign.utils.Day.java

@SuppressWarnings("deprecation")
public static String addSeconds(String dateTime, int seconds) {

    Date date = getDateWithTyphoonFormatString(dateTime);
    date.setSeconds(date.getSeconds() + seconds);

    return Day.toStringAsyyyyMMddHHmmss(date.getTime());

}

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);
    today.setMinutes(0);/*from   w ww.j  a  va 2s. com*/
    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;
}

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

@SuppressWarnings("deprecation")
@Override/*from w  w  w . j a v a  2s .c om*/
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:br.com.hslife.orcamento.service.AgendaService.java

@SuppressWarnings("deprecation")
public List<Agenda> buscarAgendamentosDoDia() {
    CriterioAgendamento criterioBusca = new CriterioAgendamento();
    Date inicio = new Date();
    inicio.setHours(0);//www. j a  va2s. c  o m
    inicio.setMinutes(0);
    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: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);
    //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);
    }//  w ww . j a  v a  2 s . c o m
    return date;
}