I know there are lots of questions on SO about how to get Date
s in Java, but I want an example using new Java 8 Date
API. I also know about the JodaTime library, but I want a method without relying on external libraries.
The function needs to be compliant with these restrictions:
- Prevent errors from date savetime
- Inputs are two
Date
objects (without time, I know aboutLocalDateTime
, but I need to do this withDate
instances)
DAYS.between(localDate1, localDate2)
. – Dive