Java Calendar compare value before or after another
import java.util.Calendar; public class Main { public static void main(String[] args) { Calendar old = Calendar.getInstance(); /*ww w .jav a 2 s. c o m*/ old.set(Calendar.YEAR, 1990); Calendar now = Calendar.getInstance(); System.out.println("Is old before now ? : " + old.before(now)); System.out.println("Is old after now ? : " + old.after(now)); } }