Android Date Interval Get getDaysSince(Date date)

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

Description

get Days Since

License

Open Source License

Declaration

public static int getDaysSince(Date date) 

Method Source Code

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

import java.util.Date;

public class Main {
    private static final long ONE_DAY_IN_MILLIS = 24 * 60 * 60 * 1000;

    public static int getDaysSince(Date date) {
        if (date == null) {
            return 0;
        }// ww w  .  j  a v  a2s  .  c  om
        return (int) ((getCurrentEpochTime() - date.getTime()) / ONE_DAY_IN_MILLIS);
    }

    private static long getCurrentEpochTime() {
        return new Date().getTime();
    }
}

Related

  1. getOffectMinutes(long date1, long date2)
  2. getStringByOffset(Date date, String format, int calendarField, int offset)
  3. getStringByOffset(Date date, String format, int calendarField, int offset)
  4. getStringByOffset(String strDate, String format, int calendarField, int offset)
  5. getStringByOffset(String strDate, String format, int calendarField, int offset)
  6. timeAgo(Date d)