This function will return , the passed year is a leap year or not
CREATE FUNCTION dbo.fn_IsLeapYear (@year int)
RETURNS BIT
as
BEGIN
RETURN(SELECT CASE DATEPART(MM, DATEADD(DD, 1, CAST((CAST(@YEAR AS VARCHAR(4)) + '0228') AS DATETIME)))
WHEN 2 THEN 1
ELSE 0
END)
END
GO
Ref:http://ashiskrdas.blogspot.com/
CREATE FUNCTION dbo.fn_IsLeapYear (@year int)
RETURNS BIT
as
BEGIN
RETURN(SELECT CASE DATEPART(MM, DATEADD(DD, 1, CAST((CAST(@YEAR AS VARCHAR(4)) + '0228') AS DATETIME)))
WHEN 2 THEN 1
ELSE 0
END)
END
GO
Ref:http://ashiskrdas.blogspot.com/
No comments :
Post a Comment