Java Date Create add24HtoDate(Date date)

Here you can find the source of add24HtoDate(Date date)

Description

add Hto Date

License

Open Source License

Declaration

public static Date add24HtoDate(Date date) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class Main {
    public static Date add24HtoDate(Date date) {
        Calendar cal = new GregorianCalendar();
        cal.setTime(date);// w  w w. jav  a 2  s.c  om
        cal.setTimeInMillis(date.getTime());// sumamos 24h a la fecha del login
        cal.add(Calendar.DATE, 1);
        return new Date(cal.getTimeInMillis());
    }

    public static String getTime() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
        return sdf.format(new Date());
    }
}

Related

  1. addTimeToDate(Date date, Date time)
  2. buildDate(int y, int m, int d)
  3. buildDate(String dateAsString)
  4. buildDateFormat(final String pattern)