Reputation: 91
I need to normalise some Data to execute a SQL-Statement. Unfortunately I can't initialize a LocalDate-variable with LocalDate.EPOCH. MIN and MAX are working.
startDatum = startDatum == null? LocalDate.EPOCH : startDatum; // doesn't work
endDatum = (endDatum == null)? LocalDate.MAX : endDatum; // works
Eclipse only says EPOCH cannot be resolved or is not a field
Upvotes: 6
Views: 1176
Reputation: 28036
The EPOCH
field on LocalDate
was new in Java 9. If you're using Java 8, you can do the following to get the LocalDate
at epoch:
LocalDate.ofEpochDay(0)
Upvotes: 8