java.util.Calendar.before() is a method in Calendar class of java.util package. The method returns true if the time represented by this Calendar is before the time represented by when Object. If it is not the case, false is returned.
public boolean before(Object when) Where, when is the Object that is to be compared.
Below are some examples to understand the implementation of the Calendar.before() function in a better way.
Example 1 :
Time 1 : Wed Feb 28 15:43:19 IST 2018 Time 2 : Wed Feb 28 15:43:22 IST 2018 true
Example 2 :
Current date is : Wed Feb 28 15:50:16 IST 2018 Year is 2010 Result : false
Example 3 :
Current date is : Wed Feb 28 16:15:55 IST 2018 Year is 2025 Result : true
- Java.util.Collections.rotate() Method in Java with Examples
- Java lang.Long.numberOfLeadingZeros() method in Java with Examples
- Java lang.Long.numberOfTrailingZeros() method in Java with Examples
- Java lang.Long.highestOneBit() method in Java with Examples
- Java lang.Long.reverse() method in Java with Examples
- Java lang.Long.byteValue() method in Java with Examples
- Java.lang.Short toString() method in Java with Examples
- Java.util.Collections.disjoint() Method in java with Examples
- Java lang.Long.lowestOneBit() method in Java with Examples
- Java Clock withZone() method in Java with Examples
- Java Clock tickMinutes() method in Java with Examples
- Java.math.BigInteger.modInverse() method in Java
- Java.math.BigInteger.probablePrime() method in Java
- Java.util.ArrayList.addall() method in Java
- Java 8 | ArrayDeque removeIf() method 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.