Here you can find the source of isLongTerm(Timestamp oldTime, Timestamp newTime)
public static boolean isLongTerm(Timestamp oldTime, Timestamp newTime)
//package com.java2s; //License from project: Open Source License import java.sql.Timestamp; public class Main { public static boolean isLongTerm(Timestamp oldTime, Timestamp newTime) { long delta = Math.abs(newTime.getTime() - oldTime.getTime()); int days = (int) (delta / (1000 * 60 * 60 * 24)); // System.out.println("Days: " + days); if (days >= 365) { // System.out.println("long..."); return true; }// ww w . j a va2 s . c o m // System.out.println("short..."); return false; } }