Online Java Compiler By
JavaTpoint.com
import java.util.Date; public class JavaDateBeforeExample2 { public static void main(String[] args) { Date d=new Date(2018,9,21); Date d2=new Date(1997,3,10); System.out.println("Date 'd' is before Date 'd2' : "+d.before(d2)); } }
Output