DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

DateOnly

01.18.2006
| 4152 views |
  • submit to reddit
        
-- Gets the date part of a datetime input
-- Created 08/05/04 by Oskar Austegard
ALTER FUNCTION dbo.fnDateOnly
(
	@DateTime datetime --The input date whose date part we want
)
RETURNS datetime
AS
BEGIN
	RETURN (CONVERT(datetime, CONVERT(varchar(10), @DateTime, 101)))
END

Oskar Austegard
<a href="http://mo.notono.us">http://mo.notono.us</a>