Get Day only from a datetime variable
18>
19> CREATE FUNCTION DayOnly(@Date datetime)
20> RETURNS varchar(12)
21> WITH SCHEMABINDING
22> AS
23> BEGIN
24> RETURN CONVERT(varchar(12), @Date, 101)
25> END
26> GO
1> select dbo.DayOnly(GetDATE())
2> GO
------------
10/22/2006
(1 rows affected)
1> drop function DayOnly
2> GO
1>
2>
Related examples in the same category