Java Calendar before() Methodjava.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. SyntaxParameterWhen - when is the Object that is to be compared. ReturnsThis method return True or false value ThrowsNA Example 1Output: Current date: Mon Jul 30 04:08:30 PDT 2018 Year is 2015 Date Thu Jul 30 04:08:30 PDT 2015 is before current date. Example 2Output: Current date: Mon Jul 30 04:13:04 PDT 2018 Year is 4 Date Wed May 30 04:13:04 PDT 2018 is before current date. Example 3Output: Current date: Mon Jul 30 06:19:04 PDT 2018 Year is 23 Date Mon Jul 23 06:19:04 PDT 2018 is before current date. Example 4Output: Current date: Mon Jul 30 06:23:37 PDT 2018 Now date is Tue Jul 31 06:23:37 PDT 2018 Now date is Tue Jul 31 07:00:37 PDT 2018 Now date is Tue Jul 31 07:00:30 PDT 2018 Next TopicJava-calendar-clear-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India