Quantcast
Viewing all articles
Browse latest Browse all 10

SQL First Day of Month

This post describes how to find the first day of a month in SQL.

The code is: DATEADD(mm,DATEDIFF(mm,0,DateToRemoveTime),0)

A full explanation of how this works is in a previous post describing how to remove the time portion of a datetimein SQL as the concept is exactly the same except where removing the time uses the day (dd) in the above date functions, to get the first day of the month you use the month (mm) instead.

The post SQL First Day of Month appeared first on Business Analytics.


Viewing all articles
Browse latest Browse all 10

Trending Articles