Here you can find the source of getDiffTime(Timestamp last)
public static long getDiffTime(Timestamp last)
//package com.java2s; //License from project: Open Source License import java.sql.Timestamp; import java.util.Date; public class Main { public static long getDiffTime(Timestamp last) { Date date = new Date(); Timestamp now = new Timestamp(date.getTime()); long nowSec = now.getTime() / 1000; long lastSec = last.getTime() / 1000; if (nowSec > lastSec) { return nowSec - lastSec; } else {//from w w w. j a v a 2s . c o m return lastSec - nowSec; } } }