What is the minimum date value in Java?
-
21What does the minimum date mean ? – qrtt1 Oct 01 '10 at 10:14
-
2possible duplicate of [Java: What/where are the maximum and minimum values of a GregorianCalendar?](http://stackoverflow.com/questions/2393016/java-what-where-are-the-maximum-and-minimum-values-of-a-gregoriancalendar) – Pascal Thivent Oct 01 '10 at 11:20
-
See this thread http://stackoverflow.com/questions/2393016/java-what-where-are-the-maximum-and-minimum-values-of-a-gregoriancalendar – sproketboy Oct 01 '10 at 10:22
-
@qrtt1 the Big Bang of course. Unless you happen to be very good at mathematics and meta-physics. – Adam Oct 11 '17 at 13:05
5 Answers
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));

- 19,012
- 6
- 50
- 68
-
5But this seems to be a date in the future (year 292269055), not in the past. Seems that the parameter is being interpreted as a positive value. – Grodriguez Oct 01 '10 at 10:47
-
1
-
1
-
@Thorbjørn Ravn Andersen: what else is there in standard java to use instead of the Calendar? – Denis Tulskiy Oct 01 '10 at 10:57
-
2
-
2
-
3@Adam: yeah, it's about the time of dinosaurs, I was just too lazy to edit the answer :) – Denis Tulskiy Nov 30 '12 at 03:39
-
2Hahahah the time of Big Bang and dinossaurs just made my day :D – João Rocha da Silva May 18 '15 at 16:30
-
1so the first day of the java was a holiday. Pretty lazy language :) – Muhammad Saqib Jan 09 '20 at 14:36
If you are talking about java.util.Date
as a timestamp you can do this
Date d = new Date(0L)
and you will see this represents Thu Jan 01 01:00:00 GMT 1970
As tulskiy has pointed out it is possible to pass a negative value to the Date constructor. If we do this and use a date format that includes the era we can see:
Date d = new Date(Long.MIN_VALUE);
DateFormat df = new SimpleDateFormat("EEE, d MMM yyyy G HH:mm:ss Z");
System.out.println(df.format(d));
displays: Sun, 2 Dec 292269055 BC 16:47:04 +0000
The other Answers may be correct but use outmoded classes.
java.time
The old date-time classes (java.util.Date/.Calendar etc.) have been supplanted by the java.time framework built into Java 8 and later.
The java.time classes are inspired by Joda-Time, defined by JSR 310, extended by the ThreeTen-Extra project, back-ported to Java 6 & 7 by the ThreeTen-Backport project, and adapted to Android in the ThreeTenABP project. See Tutorial.
For a moment on the timeline in UTC with a resolution of nanoseconds, use Instant
. Given an offset-from-UTC, use OffsetDateTime
. For a time zone (offset + rules for anomalies), use ZonedDateTime
, but by its nature has no defined minimum, nor does ZoneId
. For a date-only value without time-of-day and without time zone, use LocalDate
. For a time-of-day only value without date and without time zone, use LocalTime
. For date-time without time zone, use LocalDateTime
.
Instant.MIN
=-1000000000-01-01T00:00Z
OffsetDateTime.MIN
=-999999999-01-01T00:00:00+18:00
LocalDate.MIN
=-999999999-01-01
LocalTime.MIN
=00:00
LocalDateTime.MIN
=-999999999-01-01T00:00:00
Year.MIN_VALUE
=-999,999,999
ZoneOffset.MIN
=-18:00
(but-12:00
in practice)
Caution: Be wary of using these values as some kind of flag or special meaning. Many other software libraries and databases may not support these extreme values.
For a flag or special meaning such as a non-null "no value available", I suggest picking an arbitrary moment but avoid going to such extreme reaches either backward or forward in time. Perhaps the Unix epoch reference date, the first moment of 1970 in UTC, 1970-01-01T00:00:00Z. Defined as a constant in Java: Instant.EPOCH

- 303,325
- 100
- 852
- 1,154
It's the same as for the Calendar classes.
Try this:
Date d = new Date( Long.MIN_VALUE );
System.out.println( d );
You'll see:
Sun Dec 02 16:47:04 GMT 292269055
But the default date format doesn't include the era - which is BCE for this date.

- 76,436
- 32
- 213
- 198
LocalDateTime MIN defines the minimum supported LocalDateTime, '-999999999-01-01T00:00:00'. This is the local date-time of midnight at the start of the minimum date.
public static final LocalDateTime MIN; this is the MIN syntax;
import java.time.LocalDateTime;
public class Main {
public static void main(String[] args) {
LocalDateTime a = LocalDateTime.MIN;
System.out.println(a);
}
}

- 187
- 1
- 6