|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
DateDiff
hi. i need some help[ here.
how do i use the DateDiff function to select data that are posted in the last two weeks only [given all rows entered had a timestamp field] |
|
#2
|
||||
|
||||
|
You can use GETDATE() to get the current datetime and DATEADD() with a negative offset to get a date two weeks ago, something like this:
SELECT * From Table WHERE LogDate >= DATEADD(DAY, -14, GETDATE())
__________________
Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest Down with Sharon Osbourne Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > DateDiff |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|