Java Timestamp longFromTimestamp(Timestamp ts)

Here you can find the source of longFromTimestamp(Timestamp ts)

Description

Returns the number of milliseconds since the epoch represented by the time stamp ts, or #NULL_TIME if ts is null.

License

Open Source License

Declaration

public static long longFromTimestamp(Timestamp ts) 

Method Source Code


//package com.java2s;

import java.sql.Timestamp;

public class Main {
    public static final long NULL_TIME = -1;

    /**/*from w  w  w .j av a  2s  .  c om*/
     * Returns the number of milliseconds since the epoch represented
     * by the time stamp <code>ts</code>, or {@link #NULL_TIME} if
     * <code>ts</code> is <code>null</code>.
     */
    public static long longFromTimestamp(Timestamp ts) {
        if (ts == null) {
            return NULL_TIME;
        }
        return ts.getTime();
    }
}

Related

  1. isTimeStamp(Class o)
  2. isTimestamp(String aS_DateTime, String aS_Format)
  3. isTimestamp(String str)
  4. isValid(Timestamp validFrom, Timestamp validTo, Timestamp testDate)
  5. long2Timestamp(Long longValue)
  6. max(Timestamp ts1, Timestamp ts2)
  7. maxTime(Timestamp dayTime)
  8. minusHours(Timestamp ts, int hours)
  9. minusOneSecond(Timestamp now)