Thursday, May 28, 2009

SQL Server Function to get date without time

CREATE FUNCTION [dbo].[getDateWithoutTime](
@date datetime
)
RETURNS smalldatetime
AS
BEGIN
DECLARE @returnDate smalldatetime
SET @returnDate = cast(cast(month(@date) as varchar(2)) + '-' + cast(day(@date) as varchar(2)) + '-' + cast(year(@date) as varchar(4)) as smalldatetime)
RETURN @returnDate
END


http://www.daksatech.com/
Web technology solutions for small and medium enterprises.

No comments: