Minimum date in Java

Don’t forget that Date constructor happily accepts negative values.

Date date = new Date(Long.MIN_VALUE);

returns

Sun Dec 02 22:47:04 BDT 292269055

I guess that’s about the time of Big Bang dinosaurs 🙂

EDIT

As martin clayton answered, you can use the Calendar class to check the era. This will output 0 which stands for BCE:

Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date(Long.MIN_VALUE));
System.out.println(calendar.get(Calendar.ERA));

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)