Android SQL Date Compare dateDiffer(java.sql.Date date1, java.sql.Date date2)

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

Description

date Differ

Declaration

public static int dateDiffer(java.sql.Date date1, java.sql.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);
    }/* w ww. j a  v  a  2s  .c o  m*/

    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);
    }
}