Java SQL Time getIntervalDays(Date time1, Date time2)

Here you can find the source of getIntervalDays(Date time1, Date time2)

Description

get Interval Days

License

Open Source License

Declaration

public static int getIntervalDays(Date time1, Date time2) 

Method Source Code


//package com.java2s;
import java.sql.Timestamp;

import java.util.Date;

public class Main {

    public static int getIntervalDays(long time1, long time2) {
        return (int) (time1 - time2) / (24 * 60 * 60 * 1000);
    }//from   ww  w  .j  a va2 s .c om

    public static int getIntervalDays(Date time1, Date time2) {
        if (time1 == null || time2 == null)
            return 0;
        return getIntervalDays(time1.getTime(), time2.getTime());
    }

    public static int getIntervalDays(Timestamp time1, Timestamp time2) {
        if (time1 == null || time2 == null)
            return 0;
        return getIntervalDays(time1.getTime(), time2.getTime());
    }
}

Related

  1. getFormatDateTime(Date dateTime)
  2. getFormatDateTimeDesc(long longDate)
  3. getFullDateTime(ResultSet rs, String column)
  4. getFutureTime(int month)
  5. getGrandfatheredTime()
  6. getJoinedSysDateTime()
  7. getLastTimeOfDay(Calendar calendar)
  8. getMaxModifyTime(String path)
  9. getMaxPollTime(final Connection jdbcConnection, final String tableName)