Date.before(Date when) has the following syntax.
public boolean before(Date when)
In the following code shows how to use Date.before(Date when) method.
// w w w . j a v a 2 s . c o 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.