Java Date Difference diffDay(Date date1, Date date2)

Here you can find the source of diffDay(Date date1, Date date2)

Description

diff Day

License

Open Source License

Declaration

public static int diffDay(Date date1, Date date2) 

Method Source Code

//package com.java2s;

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

public class Main {

    public static int diffDay(Date date1, Date date2) {
        Calendar aCalendar = Calendar.getInstance();
        aCalendar.setTime(date1);/*from ww w . j a v a2 s  . co m*/
        int day1 = aCalendar.get(Calendar.DAY_OF_YEAR);
        Calendar bCalendar = Calendar.getInstance();
        bCalendar.setTime(date2);
        int day2 = bCalendar.get(Calendar.DAY_OF_YEAR);
        return day2 - day1;
    }
}

Related

  1. diffDate(java.util.Date date, java.util.Date date1)
  2. diffDateD(Date sd, Date ed)
  3. diffDateM(Date sd, Date ed)
  4. diffDates(long starttime, long endtime, int type)
  5. diffDateSec(java.util.Date date, java.util.Date date1)
  6. diffDay(Date start, Date end)
  7. diffDay(Date startDate, Date endDate)
  8. differDays(Date src, Date target)
  9. difference(Date date1, Date date2)