Java Date Between getBetweenWorkDate(int amount, Date beginDate)

Here you can find the source of getBetweenWorkDate(int amount, Date beginDate)

Description

get Between Work Date

License

Open Source License

Declaration

public static Date getBetweenWorkDate(int amount, Date beginDate) 

Method Source Code

//package com.java2s;

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

public class Main {

    public static Date getBetweenWorkDate(int amount, Date beginDate) {
        int addDate = 0;
        for (int ii = 1; ii <= amount; ii++) {
            Calendar cal2 = Calendar.getInstance();
            cal2.setTime(beginDate);//from w  w  w .j  a  va  2 s  .  co m
            cal2.add(Calendar.DATE, ii);
            int week = cal2.get(Calendar.DAY_OF_WEEK);
            if (week != 1 && week != 7) {
                addDate++;
            }
        }
        Calendar cal2 = Calendar.getInstance();
        cal2.setTime(beginDate);
        cal2.add(Calendar.DATE, addDate);
        return cal2.getTime();
    }
}

Related

  1. getBetweenDateBuckets(Date from, Date to)
  2. getBetweenDates(Date fromDate, Date toDate )
  3. getBetweenDays(String strFromDate, String strToDate)
  4. getBetweenMonths(Date date1, Date date2)
  5. getBetweenTime(Date begin, Date end, int field)
  6. isBetween(Date check, Date from, Date to)
  7. isBetween(Date date, Date d1, Date d2)