Java Timestamp beforeTimestamp2Safety(Timestamp ts1, Timestamp ts2)

Here you can find the source of beforeTimestamp2Safety(Timestamp ts1, Timestamp ts2)

Description

Safety compare two timestamp, skip null value

License

Open Source License

Parameter

Parameter Description
ts1 first timestamp
ts2 second timestamp

Return

if @param ts1 before @param ts2, return true, else return false

Declaration

public static boolean beforeTimestamp2Safety(Timestamp ts1, Timestamp ts2) 

Method Source Code

//package com.java2s;
/*/* www  .  java2 s.  c om*/
 * File: $RCSfile$
 *
 * Copyright (c) 2005 Wincor Nixdorf International GmbH,
 * Heinz-Nixdorf-Ring 1, 33106 Paderborn, Germany
 * All Rights Reserved.
 *
 * This software is the confidential and proprietary information
 * of Wincor Nixdorf ("Confidential Information"). You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered
 * into with Wincor Nixdorf.
 */

import java.sql.Timestamp;

public class Main {
    /**
     * Safety compare two timestamp, skip null value
     *
     * @param ts1 first timestamp
     * @param ts2 second timestamp
     * @return if @param ts1 before @param ts2, return true, else return false
     */
    public static boolean beforeTimestamp2Safety(Timestamp ts1, Timestamp ts2) {
        return ts2 != null && ts1.before(ts2);
    }
}

Related

  1. adjustTimestamp(Timestamp stamp, int adjType, int adjQuantity, TimeZone timeZone, Locale locale)
  2. adjustTimestamp(Timestamp stamp, Integer adjType, Integer adjQuantity)
  3. adjustTimestamp(Timestamp timestamp, String timezone, int gmtOffset)
  4. afterMinutes(Timestamp date, long min)
  5. argMapTimestamp(Map argMap, Map argMapNotUsed, String key)
  6. between(Timestamp t1, Timestamp t2)
  7. calcRealTime(Timestamp beginTime, Timestamp endTime)
  8. calendar2Timestamp(Calendar c)
  9. calendarToTimestamp(java.util.Calendar inCal)