I have the following sql server WHERE
clause:
WHERE (DateCreated >= CONVERT(datetime, GETDATE(), 111) - 1)
This gets the date (where today is 2015-06-09) 2015-06-08
. I need to add a time to this as well like 2015-06-08 04:00:00
in 24H format. the time will always be the same bat every time the SQL command is executed, it should only be from yesterday at 4 AM to the current date and time.
how can this be achieved?
Try this:
WHERE DateCreated >= dateadd(d, datediff(d, 1, getdate()), '04:00')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With