Thursday, 30 January 2014 12:04

First Day of the week

Share this post

Get the First Day of the week

CREATE FUNCTION [dbo].[udf_GetFirstDayOfWeek]
(
	-- Add the parameters for the function here
	@Date datetime
)
RETURNS datetime
AS
BEGIN
	-- Declare the return variable here
	DECLARE @ResultVar datetime

	-- Add the T-SQL statements to compute the return value here
	SELECT @ResultVar = DATEADD(ww, DATEDIFF(ww,0,@Date), 0)

	-- Return the result of the function
	RETURN @ResultVar

END

Read 21431 times Last modified on Thursday, 30 January 2014 12:04