Java Day End getApartDate(Date startDate, Date endDate)

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

Description

get Apart Date

License

Apache License

Declaration

public static int getApartDate(Date startDate, Date endDate) 

Method Source Code

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

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

public class Main {

    public static int getApartDate(Date startDate, Date endDate) {
        Calendar sd = Calendar.getInstance();
        Calendar ed = Calendar.getInstance();
        sd.setTime(startDate);/*from   ww  w  . j  a v a  2 s. c  o  m*/
        int day1 = sd.get(Calendar.DAY_OF_YEAR);
        ed.setTime(endDate);
        int day2 = ed.get(Calendar.DAY_OF_YEAR);
        sd = null;
        ed = null;
        return (day2 - day1) + 1;
    }
}

Related

  1. endOfDayInMillis(long date)
  2. endOfTheMonth(java.util.Date date, Locale locale)
  3. endOfYear(Date referenceDate, TimeZone timeZone)
  4. fillBetweenDays(Date from, Date to)
  5. getAgeInDays(Date startDate, Date endDate)
  6. getBetweenDays(String strFromDate, String strToDate)
  7. getCalender(Date date)
  8. getCertificateEndDate(int days)
  9. getDatebetweenOfDays(Date startDate, Date endDate)