How do i get the date for last friday of the month in T-SQL?
I will be passing the year and month as parameter,e.g, 201211. If I pass '201211' as parameter it should return me '20121130' as answer as it's the date of last friday of month of november'12.
5-Jan-1900
to19000105
. But relying on 'magic' numbers and dates in code is a rather dubious practice because it's not at all obvious to anyone reading the code what they actually mean. Especially if the original programmer doesn't leave any comments, it can be extremely difficult to maintain code like this. – Abacist