Android Date Compare dateDiffer(Date date1, Date date2)

Here you can find the source of dateDiffer(Date date1, Date date2)

Description

date Differ

Declaration

public static int dateDiffer(Date date1, Date date2) 

Method Source Code

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

import java.util.Date;

public class Main {
    public static int dateDiffer(Date date1, Date date2) {
        if (date1 == null || date2 == null)
            return 0;
        return (int) ((date2.getTime() + 28800000) / 86400000 - (date1
                .getTime() + 28800000) / 86400000);
    }/*from   w w  w  .  java  2s .com*/

    public static int dateDiffer(java.sql.Date date1, java.sql.Date date2) {
        if (date1 == null || date2 == null)
            return 0;
        return (int) ((date2.getTime() + 28800000) / 86400000 - (date1
                .getTime() + 28800000) / 86400000);
    }

    public static int dateDiffer(Timestamp date1, Timestamp date2) {
        if (date1 == null || date2 == null)
            return 0;
        return (int) ((date2.getTime() + 28800000) / 86400000 - (date1
                .getTime() + 28800000) / 86400000);
    }
}

Related

  1. dateAfterDate(Date date, long days)
  2. dateBeforeDate(Date date, long days)
  3. isSameDay(Date dateSource, Date dateDesti)
  4. isSameInstant(Date date1, Date date2)
  5. needsMidnightCountdown()
  6. compare(Date date1, Date date2)
  7. compare(String date0, String date1, String format)
  8. isDateTimeAfter(String startDate, String startTime, String endDate, String endTime)
  9. isDateNew(String YearMonthDayHourMinuteSeconds)