there is always something to develop
How to find first and last day of the month
The sample bellow shows how to find the start and end date of the month containing specified date.
declare @cDateTime datetime; set @cDateTime = GetDate() select dateadd( month, datediff( month, 0, @cDateTime ), 0 ) as BeginOfTheMonth; select dateadd(d,-1,dateadd( month, datediff( month, 0, @cDateTime )+1,0 )) as EndOfTheMonth
See also
Comments
"Everything is funny as long as it is happening to somebody else"
You are 4363 reader
since 1st April 2009
Yes | 0 | |
No | 100.0% |
2 |