t-sql query add time to getdate function in where clause
Posted on 2014-12-11
i'm using sql server 2008 R2.
I have a table with a smalldatetime column called FromDate
I want to filter FromDates that are between today's date and 3 days from today.
Today's date is 12/11/2014.
Right now my where clause looks like this:
WHERE ([FromDate] >= getdate()) AND ([FromDate] <= dateadd(days, 3, getdate()) )
But that doesn't take time into consideration.
how do I revise my where clause to to include 00:00:00 to today's date and 23:59:59 to 3 days from today.
So then my where clause would be filtering between
12/11/2014 00:00:00 (today's date)
12/14/2014 23:59:59 (three days from day)