Here you can find the source of getDiffSecond(long orgTimestamp, long desTimestamp)
public static int getDiffSecond(long orgTimestamp, long desTimestamp)
//package com.java2s; import java.sql.Timestamp; public class Main { public static int getDiffSecond(long orgTimestamp, long desTimestamp) { return (int) ((orgTimestamp - desTimestamp) / 1000); }//from w ww .j av a2 s. com public static int getDiffSecond(long orgTimestamp, String sqlDateTime) { long desTimestamp = getTimestamp(sqlDateTime); return (int) ((orgTimestamp - desTimestamp) / 1000); } public static long getTimestamp(String sqlDateTime) { return Timestamp.valueOf(sqlDateTime).getTime(); } }