Sign In | Feedback | Donate | Search
Katie and Emil Logo
Vote Yes! I like it! [+0]  |  Vote no! Dislike? [-0]
Author: by Katie Glownia
If you are after T-SQL First Day of Previous Month calculation then you are in the right place.

To return first day of previous month using T-SQL we can use the following statement:

SELECT DATEADD(m,-1, Dateadd(d,1-DATEPART(d,getdate()),GETDATE())) AS [First Day of Previous Month]

Below is explanation how the t-sql statement calculates first day of previous month:

First Day of Previous month
1) Our today's date is 20th of Feb. We substract number of days in the month from our date (20) and we get last day of previous month.
2) We add one day to get first day of current month.
3) We go one month back so first day of the month stays the same and Feb changes to Jan.

The result of this T-SQL statement is first day of previous month.

Hope that helps!
Katie
Upsss... Something went wrong and Google Ads on our website did not display.

Google ads sponsor FREE content on our website and without them it would not exist.

How to fix the problem?
  1. Check if the Google Search display any ads by searching the term Business Intelligence
    • If ads don't display, try different search terms and if there no ads then there might be a problem with your browser. If you made changes to your browser behaviour then undoing them will help.
    • If ads display then, refresh our page one more time, if the problem is still there than please contact us.
  2. Become 'No Ads Learner' Member or if you are already one Sign In.
Close
Take care
Katie & Emil
Well done! It seems Google Ads display properly now on our website.

Access our website's FREE content for FREE!