SQL Server dates

by Joe Hunter 15. February 2010 13:21

A frequent requirement with T-SQL is to convert dates into different formats, usually

from MM/DD/YYYY to DD/MM/YYYY. In order to do this avail of the CONVERT function:

CONVERT(VARCHAR(10), theDateInMMDDYYY, 103)

Or if you only require the TIME use this:

CONVERT(VARCHAR(10), theDateInMMDDYYY, 108)

Reference:http://msdn.microsoft.com/en-us/library/aa226054(SQL.80).aspx

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen