Is there a Java equivalent of DateTime.MinValue and DateTime.Today in the Java Date class? Or a way of achieving something similar?
I\'ve realised how spoilt you are
The de-facto Java datetime API is joda-time.
With it, you can get the current date/time by just constructing new DateTime()
.
Similarly, Without it, you can use Calendar.getInstance()
or new Date()
to obtain the current date/time.
MinValue
can be Calendar.getInstance(0)
/ new Date(0)
. This would use the default chronology - i.e. since January 1st, 1970. Since MinValue
returns Januar 1st, year 1, you can do that be simply specifying this date, using the appropriate constructor of DateTime
.