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

0

Please login or register to vote for this query.

(click on this box to dismiss)

Korean Language

Q&A for linguists, teachers and students of the Korean language

SELECT 
DATEADD(day, 6 - (DATEDIFF(day, '01/01/2010', GETDATE()) - 1) % 7, GETDATE())
as new_date, 

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(year, DATEDIFF(year, 0, GETDATE()), 0) As First_Of_Current_year
  , DateAdd(dd, -1, DateAdd(yy, DateDiff(yy, 0, GETDATE()) +1, 0)) As Last_Of_Current_year
  , DATEADD(YEAR, DATEDIFF(YEAR, 0, GETDATE())-1, 0) As First_Of_Last_Year
     , convert(varchar , DATEADD(Year, DATEDIFF(year, -1, GETDATE()) -1, -1), 112) as int 
  
    ,DATEADD(mm, DATEDIFF(mm, 0, GETDATE())-15, 0) as test

Enter Parameters

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