The before() function is a part of Timestamp class of Java SQL.The function returns a boolean value representing whether the Timestamp object occurs before the given Timestamp object.
public boolean before(Timestamp t)
Parameters: The function accepts Timestamp object as parameter which is to be checked.
Return value: The function returns boolean data type representing whether the Timestamp object occurs before the given Timestamp object.
Exception: The function does not throw any exceptions
Below examples illustrate the use of before() function
Example 1: Create two non equal timestamps and check whether the second timestamp occurs before first timestamp or not.
Second Timestamp occurs before first timestamp
Example 2: Create two equal timestamps and check whether the second timestamp occurs before the first timestamp or not
Second Timestamp does not occur before first timestamp
Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.
- Java SQL Timestamp setTime() function with examples
- Java SQL Timestamp setNanos() function with examples
- Java SQL Timestamp after() function with examples
- Java SQL Timestamp getTime() function with examples
- Java SQL Timestamp getNanos() function with examples
- UUID timestamp() Method in Java with Examples
- Date before() method in Java with Examples
- Java Program to Convert Date to TimeStamp
- Calendar.before() method in Java
- Performing Database Operations in Java | SQL CREATE, INSERT, UPDATE, DELETE and SELECT
- How to implement SQL GROUP BY in Java?
- Java.util.function.BiPredicate interface in Java with Examples
- Java.util.function.DoublePredicate interface in Java with Examples
- Java.util.function.LongPredicate interface in Java with Examples
- Java.util.function.IntPredicate interface in Java with Examples
- How to Execute Multiple SQL Commands on a Database Simultaneously in JDBC?
- Java.util.BitSet class methods in Java with Examples | Set 2
- Java.util.BitSet class in Java with Examples | Set 1
- Java.util.Collections.rotate() Method in Java with Examples
- Java.util.Collections.frequency() in Java with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.