Android Date Interval Get secondsBetween(Date dt1, Date dt2)

Here you can find the source of secondsBetween(Date dt1, Date dt2)

Description

seconds Between

License

Open Source License

Declaration

public static int secondsBetween(Date dt1, Date dt2) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Date;

public class Main {
    public static int secondsBetween(Date dt1, Date dt2) {
        long msDiff = millisecondsBetween(dt1, dt2);
        if (msDiff == 0) {
            return 0;
        }/*from  www  .j  av a  2s  .c  om*/
        return (int) (msDiff / 1000);
    }

    public static long millisecondsBetween(Date dt1, Date dt2) {
        if (dt1 == null || dt2 == null)
            return 0;
        return Math.abs(dt1.getTime() - dt2.getTime());
    }
}

Related

  1. offsetMinute(Date date, int offset)
  2. offsetSecond(Date date, int offset)
  3. secondBetweenDate(Date date1, Date date2)
  4. secondDiff(Date date1, Date date2)
  5. secondDiff(String startTime, String endTime)
  6. getDateOffset()
  7. interval(Date date)
  8. checkIsIntervalDay(String startTime, String endTime)
  9. totalDays(Object o)