Express12
SSCoach
Points: 18514
More actions
March 21, 2006 at 2:24 pm
#167649
Need to return zero's in the TIME portion of this DATE:
select
dateadd(ms,-3,DATEADD(yy, DATEDIFF(yy,0,getdate() ), 0))
(this query returns the LAST day of LAST year)
PW-201837
SSC-Insane
Points: 20805
March 21, 2006 at 2:28 pm
#627971
Why subtract 3 milliseconds (thereby generating a time component) if the stated goal is ... no time component ?
select DateAdd(dd, -1, DATEADD(yy, DATEDIFF(yy,0,getdate() ), 0))
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply