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 datetime in 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.

2018-05-07T20:02:52+00:00 May 19th, 2011|SQL|

One Comment

  1. Hong Kong Hotels 2011-06-08 at 02:20 - Reply

    Hi,
    this is great stuff, we need more of this especially in APAC. More SQL if you could.

Leave A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.