How should I find the dates for 3 days past and 5 days future. Such as TodayDate-3 and TodayDate+5 base in the date only, discarding the time?
Getdate()-3 , Getdate()+5 ?|||Discarding the time would be like:
DATEADD(d,0,DATEDIFF(d,0,getdate())-3) and DATEADD(d,0,DATEDIFF(d,0,getdate())+5)
|||
CONVERT(Varchar,getdate()-3, 101) shouldwork.
should work.
|||Using DATEADD/DATEDIFF is more generic because you can use the same thing to select the beginning of a day, week, month, or year. It's also keeps the result in a datetime object, is culture insensitive, and performs many times faster then the varchar methods.|||Thanks for the reply
No comments:
Post a Comment