Skip to content
Advertisement

How to determine the number of days in a month in SQL Server?

I need to determine the number of days in a month for a given date in SQL Server.

Is there a built-in function? If not, what should I use as the user-defined function?

Advertisement

Answer

You can use the following with the first day of the specified month:

To make it work for every date:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement