Tests if this date is after the specified date.
Syntax
public boolean after(Date when)
Parameters
When – The date to compare against.
Return Value − True if and only if the instant represented by this Date
object is strictly later than the instant represented by when; false otherwise.
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/12/2015"); Date latestdate = new Date(); System.out.println(olddate.after(newdate)); System.out.println(latestdate.after(newdate)); } }
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