[X]

T-SQL - How to get week of the month of given date

Microsoft has lots of in build function in T-SQL for developers. These functions come very handy in day to day t-sql developer requirement.

Today I came across a need of calculating the "Week of Current/Given Date Month". After going through the existing functions of t-sql, I was able to figure out a way to find out the week of given date. Below is the mathematical formula to calculate this:

Week of Current Month = Week of Year - Week of First Day of Current Month + 1

First Date of Current Month = Given Date - Day of Given Date + 1

 

More...

Posts By Month