I am trying to check if a coupon is valid between two given dates.
I don’t have much SQL experience but currently the code is using BETWEEN to try to validate and the issue I am running into is that the endDate expires at midnight of day before (ex.10/12/2012 00:00:00.000 evaluates to midnight of 10/11) and I need it to extend through the midnight of 10/12.
So I am wondering if appending/adding 23:59:59 to the end date is the best way of performing this evaluation?
Currently Using:
ca.CreateDate between co.StartDate and co.EndDate
Don’t use
BETWEENfor continuously varying values.You need…
But you also need to add one day to your end date values. Either in the code (
co.EndDate + 1or similar), or in the data it self.For example, if you want all times for the 1st week of 2012…
This even applies to other levels of granularity.