DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()), 0)

0

Please login or register to vote for this query.

(click on this box to dismiss)

The Great Outdoors

Q&A for people who love being outdoors enjoying nature and wilderness, and learning about the required skills and equipment

SELECT 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
  ,DATEADD(mm, DATEDIFF(mm, 0, GETDATE())-15, 0) as test

  , DATEADD(qq, DATEDIFF(qq, 0, GETDATE()) - 1, 0)-- First day of last quarter
, DATEADD(dd, -1, DATEADD(qq, DATEDIFF(qq, 0, GETDATE()), 0))-- Last day of last quarter
, DATEADD(qq, DATEDIFF(qq, 0, GETDATE()) + 1, 0)-- First day of Next quarter
, DATEADD (dd, -1, DATEADD(qq, DATEDIFF(qq, 0, GETDATE()) +2, 0))-- Last day of Next quarter

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results