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
"Doing nothing is the most tiresome thing in the world because it is impossible to quit and take a rest."
You are 4225 reader
since 1st April 2009
Yes | 0 | |
No | 0 |