January 20, 2010 at 8:42 am
I am assuming I would use the dateadd function but how would I retrieve the date from two weeks ago from today's date. I basically need to retrieve records from two weeks ago from whatever is today's date.
January 20, 2010 at 8:47 am
roundel1900 (1/20/2010)
I am assuming I would use the dateadd function but how would I retrieve the date from two weeks ago from today's date. I basically need to retrieve records from two weeks ago from whatever is today's date.
Try:select dateadd(ww,-2,getdate())
Check out BOL for more info on date functions.
+--------------------------------------------------------------------------------------+
Check out my blog at https://pianorayk.wordpress.com/
January 20, 2010 at 8:55 am
Two weeks ago including time, or two weeks ago starting from midnight?
For example,
Today = 2010-01-20 08:53:07.907
2 Weeks ago = 2010-01-06 08:53:07.907
or
Today = 2010-01-20 08:53:07.907
2 Weeks ago = 2010-01-06 00:00:00.000
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy