there is always something to develop
How to find first and last day of the year
The sample bellow shows how to find the start and end date of the year containing specified date.
declare @cDateTime datetime; set @cDateTime = GetDate() select dateadd( year, datediff( year, 0, @cDateTime ), 0 ) as BeginOfTheYear; select dateadd(d,-1,dateadd( year, datediff( year, 0, @cDateTime )+1,0 )) as EndOfTheYear
See also
Comments
"Good judgment comes from experience and, unfortunately, experience often comes from bad judgment."
You are 3845 reader
since 1st April 2009
Yes | 0 | |
No | 0 |