Java Day End getNextSendTime(Date sendDate, Date start)

Here you can find the source of getNextSendTime(Date sendDate, Date start)

Description

get Next Send Time

License

Open Source License

Declaration

public static Date getNextSendTime(Date sendDate, Date start) 

Method Source Code

//package com.java2s;

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

public class Main {

    public static Date getNextSendTime(Date sendDate, Date start) {
        Calendar calendar = Calendar.getInstance();
        if (sendDate != null) {
            calendar.setTime(sendDate);//from w w  w  .java 2 s. c  o  m
        }
        Calendar startCalendar = Calendar.getInstance();
        if (start == null) {
            startCalendar.set(Calendar.HOUR_OF_DAY, 8);
            startCalendar.set(Calendar.MINUTE, 0);
            startCalendar.set(Calendar.SECOND, 0);
        } else {
            startCalendar.setTime(start);
        }
        calendar.add(Calendar.DATE, 1);
        calendar.set(Calendar.HOUR_OF_DAY, startCalendar.get(Calendar.HOUR_OF_DAY));
        calendar.set(Calendar.MINUTE, startCalendar.get(Calendar.MINUTE));
        calendar.set(Calendar.SECOND, startCalendar.get(Calendar.SECOND));
        return calendar.getTime();

    }
}

Related

  1. getMonthsBetweenBeginDateAndEndDate(Date beginDate, Date endDate)
  2. getMonthSpan(Date begin, Date end)
  3. getMonthSpan(Date start, Date end)
  4. getMsBetween(Date startDate, Date endDate)
  5. getNextEndDate(Date date, int offset)
  6. getNumberOfDaysBetweenDates(Date beginDate, Date endDate)
  7. getNumberOfMonthsBetween(final Date begin, final Date end)
  8. getNumMonths(Date dStart, Date dEnd)
  9. getNumYears(Date dStart, Date dEnd)