Display first day of month with TIME and without TIME

Bandi
Posted by Bandi under Sql Server category on | Points: 40 | Views : 313
-- with time zeroed out
SELECT CAST(DATEADD(DAY,-DAY(GETDATE())+1, CAST(GETDATE() AS DATE)) AS DATETIME)
-- with time as it was
SELECT DATEADD(DAY,-DAY(GETDATE())+1, CAST(GETDATE() AS DATETIME))


Output
FirstDayofMonthWithOutTimePart
2015-03-01 00:00:00.000

FirstDayofMonthWithTimePart
(No column name)
2015-03-01 19:21:48.910

Comments or Responses

Login to post response