Here you can find the source of dateDiffer(Timestamp date1, Timestamp date2)
public static int dateDiffer(Timestamp date1, Timestamp date2)
//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.j a v a2 s. c om 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); } }