I am using Java 8 and querying a Mongo database which is returning a java.util.Date object. I now want to check that the item is within the last 30 days. I'm attempting to use the new time API to make the code more update to date.
So I've written this code:
java.time.LocalDateTime aMonthAgo = LocalDateTime.now().minusDays(30)
and I have a
java.util.Date dbDate = item.get("t")
How would I compare these 2?
I'm sure I could just work with completely Dates/Calendars to do the job, or introduce joda-time. But I'd prefer to go with a nicer Java 8 solution.