SELECT DATEDIFF(MONTH, 0, GETDATE()) , DATEADD(MONTH, DAT...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Motor Vehicle Maintenance and Repair Meta

Q&A about the site for mechanics and DIY enthusiast owners of cars, trucks, and motorcycles

SELECT 
    DATEDIFF(MONTH, 0, GETDATE())
  , DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()), 0) As First_Of_Current_Month
  , DateAdd(dd, -1, DateAdd(mm, DateDiff(mm, 0, GETDATE()) -1, 0)) As Last_Of_Current_Month
  , DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE())-1, 0) As First_Of_Last_Month
  , DATEADD(MONTH, DATEDIFF(MONTH, -1, GETDATE()) -1, -1) As Last_Of_Last_Month;

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results