Java Timestamp Field getDiscrepancyNum(Timestamp time1, Timestamp time2)

Here you can find the source of getDiscrepancyNum(Timestamp time1, Timestamp time2)

Description

get Discrepancy Num

License

Apache License

Declaration

public static int getDiscrepancyNum(Timestamp time1, Timestamp time2) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.sql.Timestamp;

public class Main {

    public static int getDiscrepancyNum(Timestamp time1, Timestamp time2) {
        int result = 0;
        if (time1 != null && time2 != null) {
            long temp = time1.getTime() - time2.getTime();
            if (temp > 0) {
                result = (int) ((temp / (24 * 60 * 60 * 1000)));
            } else {
                result = -(int) (((temp / (24 * 60 * 60 * 1000))));
            }/* www . j ava  2  s  .c  o  m*/

        }
        return result;
    }
}

Related

  1. getDiffDay(Timestamp time1, Timestamp time2)
  2. getDifferenceInHours(Timestamp startDateTime, Timestamp endDateTime)
  3. getDiffSecond(long orgTimestamp, long desTimestamp)
  4. getDiffTime(Timestamp last)
  5. getDiffYear(java.sql.Timestamp start, java.sql.Timestamp end)
  6. getDouble(Timestamp ts)
  7. getDuration(final Timestamp start, final Date end)
  8. getDurationHour(Timestamp time1, Timestamp time2, String direction)
  9. getDurationMinute(Timestamp createTime, Timestamp finishTime)