Android Day Compare daysSince(long date)

Here you can find the source of daysSince(long date)

Description

days Since

License

Apache License

Declaration

public static int daysSince(long date) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Calendar;

public class Main {
    public static int daysSince(long date) {
        final Calendar logDate = Calendar.getInstance();
        logDate.setTimeInMillis(date);//from www .j av  a2s .  co m
        logDate.set(Calendar.SECOND, 0);
        logDate.set(Calendar.MINUTE, 0);
        logDate.set(Calendar.HOUR_OF_DAY, 0);
        final Calendar today = Calendar.getInstance();
        today.set(Calendar.SECOND, 0);
        today.set(Calendar.MINUTE, 0);
        today.set(Calendar.HOUR_OF_DAY, 0);
        return (int) Math.round((today.getTimeInMillis() - logDate
                .getTimeInMillis()) / 86400000d);
    }
}

Related

  1. isSameDay(Date date1, Date date2)
  2. isSameDay(Calendar cal1, Calendar cal2)
  3. isDateDayEqual(long lTime1, long lTime2)
  4. getDaysAgo(String fromDay, int toOlderDay, int toOlderDayMonth)
  5. isDayChanged(long lastScan)