Java Day End getDatebetweenOfDays(Date startDate, Date endDate)

Here you can find the source of getDatebetweenOfDays(Date startDate, Date endDate)

Description

get Datebetween Of Days

License

Apache License

Declaration

public static List<Date> getDatebetweenOfDays(Date startDate, Date endDate) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

import java.util.List;

public class Main {

    public static List<Date> getDatebetweenOfDays(Date startDate, Date endDate) {
        List<Date> list = new ArrayList<Date>();
        GregorianCalendar gc1 = new GregorianCalendar(), gc2 = new GregorianCalendar();
        gc1.setTime(startDate);//from w ww.  j  a  v  a2s . c o m
        gc2.setTime(endDate);
        do {
            GregorianCalendar gc3 = (GregorianCalendar) gc1.clone();
            list.add(gc3.getTime());
            System.out.println(gc3.getTime());
            gc1.add(Calendar.DAY_OF_MONTH, 1);
        } while (!gc1.after(gc2));
        return null;
    }

    public static Date getTime(final int day) {
        return getTime(new Date(), day);
    }

    public static Date getTime(final Date date, final int day) {
        final Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) + day);
        return calendar.getTime();
    }
}

Related

  1. getAgeInDays(Date startDate, Date endDate)
  2. getApartDate(Date startDate, Date endDate)
  3. getBetweenDays(String strFromDate, String strToDate)
  4. getCalender(Date date)
  5. getCertificateEndDate(int days)
  6. getDateEnd(java.util.Date d)
  7. getDateEndDay()
  8. getDateInterval4EndDate(Date date, int hourModify)
  9. getDateList(Date begin, Date end)