Android Date Interval Get interval(Date date)

Here you can find the source of interval(Date date)




public static long interval(Date date) 

Method Source Code

//package com.java2s;

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

import java.util.TimeZone;

public class Main {
    public static long interval(Date date) {
        return (Calendar.getInstance(TimeZone.getTimeZone("GMT+08:00"))
                .getTimeInMillis() - date.getTime()) / 1000;
    }/* ww w  .  j a  va2s . c  om*/


  1. secondBetweenDate(Date date1, Date date2)
  2. secondDiff(Date date1, Date date2)
  3. secondDiff(String startTime, String endTime)
  4. secondsBetween(Date dt1, Date dt2)
  5. getDateOffset()
  6. checkIsIntervalDay(String startTime, String endTime)
  7. totalDays(Object o)
  8. calculatorDaysAgo(String date, Locale locale, String format)
  9. getFirstInterval(Context context, long lastupdate, long updateinterval)