In database I have
eventName: "TestEvent",
startDate : ISODate("2018-11-07T13:24:03.124Z"),
endDate: ISODate("2020-11-07T13:24:03.124Z")
I am setting two dates fromDate
and toDate
,
for example
fromDate:01/01/2020
toDate:01/01/2021
I want to check if the event is within this range I entered. I tried like this but the results are not correct.
if ((fromDate.after(s.getStartDate()) && toDate.before(s.getEndDate()))
|| s.getStartDate().equals(fromDate) || s.getEndDate().equals(toDate))
Please help me, I am using utils.Date in my project.
If i use :
fromDate:08/08/2017
toDate: 09/09/2022
or
fromDate:08/08/2019
toDate: 09/09/2019
it should return this event in this range.
If i use :
fromDate:01/01/2000
toDate: 01/01/2001
this event should not be in the results