Tests if this date is before the specified date.
Syntax
public boolean before(Date when)
Parameters
when − a date.
Return Value
True if and only if the instant of time represented by this Date object is strictly earlier than the instant represented by when; false otherwise.
Example
Following is an example of the usage of this method −
class Example { static void main(String[] args) { Date olddate = new Date("05/11/2015"); Date newdate = new Date("05/11/2015"); Date latestdate = new Date(); System.out.println(olddate.before(newdate)); System.out.println(olddate.before(latestdate)); } }
When we run the above program, we will get the following result −
false true
Previous Page:-Click Here
Pingback: Groovy - Dates & Times - Adglob Infosystem Pvt Ltd