Java Day of getSpecifiedDayTimeAfter(Date date)

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

Description

get Specified Day Time After

License

Open Source License

Declaration

public static Date getSpecifiedDayTimeAfter(Date date) 

Method Source Code

//package com.java2s;

import java.text.ParseException;

import java.text.SimpleDateFormat;

import java.util.Calendar;
import java.util.Date;

public class Main {

    public static String getSpecifiedDayTimeAfter(String specifiedDay) {
        Calendar c = Calendar.getInstance();
        Date date = null;//from w w w .  j  a  v  a2s.com
        try {
            date = new SimpleDateFormat("yy-MM-dd HH:mm:ss").parse(specifiedDay);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        c.setTime(date);
        int day = c.get(Calendar.DATE);
        c.set(Calendar.DATE, day + 1);

        String dayAfter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(c.getTime());
        return dayAfter;
    }

    public static Date getSpecifiedDayTimeAfter(Date date) {
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        int day = c.get(Calendar.DATE);
        c.set(Calendar.DATE, day + 1);
        c.set(Calendar.HOUR_OF_DAY, 0);
        c.set(Calendar.MINUTE, 0);
        c.set(Calendar.SECOND, 0);
        return c.getTime();
    }

    public static String parse(Date d) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd");
        String dateStr = sdf.format(d);
        return dateStr;
    }
}

Related

  1. getSetDate(Date dt, int dayNum)
  2. getSignContinusDay(Date lastSignTime)
  3. getSpcilNumDayArray(Date startDate, int num)
  4. getSpecifiedDayAfter(String specifiedDay)
  5. getSpecifiedDayAfter(String specifiedDay, int afterDay)
  6. getStandardDayFormat(Date day)
  7. getStartDate(int days, String strEndDate)
  8. getStartDateByDays(Date endDate, int days)
  9. getStringAfterNDay(String str, int n)