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