Hi ,
This function is used to find out the total no .of days in the month.
Create Function getday
(
@day datetime
)
Returns int
As
Begin
Return case
When month(@day) in (1,3,5,7,8,10,12) then 31
When month(@day) in (4,6,9,11) then 30
Else case
when (year(@day)%4=0 and
year(@day)%100!=0) or
(year(@day)%400=0)
then 29
End
End
End
Select dbo.getday('2012-02-20')