Java Date Between between(Date beginDate, Date endDate)

Here you can find the source of between(Date beginDate, Date endDate)

Description

between

License

Open Source License

Declaration

public static long between(Date beginDate, Date endDate) 

Method Source Code

//package com.java2s;

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

public class Main {

    public static long between(Date beginDate, Date endDate) {
        Calendar calBegin = Calendar.getInstance();
        Calendar calEnd = Calendar.getInstance();
        calBegin.setTime(beginDate);//from  w ww.j  a  va 2  s .c o m
        calEnd.setTime(endDate);
        calBegin.clear(14);
        calEnd.clear(14);
        long millisecs = calBegin.getTime().getTime() - calEnd.getTime().getTime();
        long remainder = millisecs % 0x5265c00L;
        return (millisecs - remainder) / 0x5265c00L;
    }
}

Related

  1. between(Date d, Date startDate, Date endDate)
  2. between(Date kezdet, Date veg, Date datum)
  3. between(Date since, Date until, Date dateIn, Date dateOut)
  4. between(Date smdate, Date bdate)