I discovered that in both SQL Server 2000 and SQL Server 2005 there is no out-of-the-box function that returns just the Date portion only from a SQL DateTime. But I found this function that returns just the date:
SELECT CONVERT(varchar, getdate(), 101)
Also, check out Jeff Smith's excellent blog here regarding SQL user-defined functions related to SQL DateTime data type.
Friday, December 19, 2008
Extract Date portion only from SQL DateTime
Labels:
convert function,
extract date only,
getdate(),
SQL DateTime,
varchar
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment