I have 2 parameters. one is defaultFromD and another is defaualtToD. if I give 2 date range for this x.CreatedOn >= defaultFromD && x.CreatedOn <= defaultToD
x.CreatedOn >= '2021-10-17' && x.CreatedOn <= '2021-10-20'
its working. but if I give same date for this two parameters this condition is not working.
x.CreatedOn >= '2021-10-20' && x.CreatedOn <= '2021-10-20'
I want to knw how to pass this 2 logic in one condition. Please help me to resolve this issue.
Thank you...
CodePudding user response:
This is due to DateTime and Date Formate.
You should try the following way.
Consider you column CreatedOn datatype is: DateTime
x.CreatedOn.Date >= '2021-10-20' && x.CreatedOn.Date <= '2021-10-20'
CodePudding user response:
Try this
x.CreatedOn.AddDays(-1) > defaultFromD && x.CreatedOn.AddDays(1) < defaultToD