Find Start of a Month for Given Date

Finds Start of the month with given date

CREATE  FUNCTION [dbo].[StartOfMonth]
(
  @date datetime
)

RETURNS datetime
AS
BEGIN
  return DATEADD(M,-1,DATEADD(mm, DATEDIFF(m,0,@date)+1,0))
END
This entry was posted in Uncategorized and tagged , , , . Bookmark the permalink.

2 Responses to Find Start of a Month for Given Date

Leave a Reply

Your email address will not be published. Required fields are marked *