Java Timestamp Field getDiffSecond(long orgTimestamp, long desTimestamp)

Here you can find the source of getDiffSecond(long orgTimestamp, long desTimestamp)

Description

get Diff Second

License

Open Source License

Declaration

public static int getDiffSecond(long orgTimestamp, long desTimestamp) 

Method Source Code


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

Related

  1. getDayStartTimestamp()
  2. getDayTime(Timestamp day, Timestamp time)
  3. getDefaultTimestamp()
  4. getDiffDay(Timestamp time1, Timestamp time2)
  5. getDifferenceInHours(Timestamp startDateTime, Timestamp endDateTime)
  6. getDiffTime(Timestamp last)
  7. getDiffYear(java.sql.Timestamp start, java.sql.Timestamp end)
  8. getDiscrepancyNum(Timestamp time1, Timestamp time2)
  9. getDouble(Timestamp ts)