Java Date.before(Date when)
Syntax
Date.before(Date when) has the following syntax.
public boolean before(Date when)
Example
In the following code shows how to use Date.before(Date when) method.
/*w ww .j a v a2s . co m*/
import java.util.Date;
public class Main {
public static void main(String[] args) {
Date date = new Date();
Date date2 = new Date();
boolean before = date2.before(date);
System.out.println(before);
before = date.before(date2);
System.out.println(before);
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.util »
Java Tutorial »
java.util »