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
"We either make ourselves miserable, or we make ourselves strong. The amount of work is the same."
You are 4252 reader
since 1st April 2009
Yes | 0 | |
No | 0 |