Convert SQL DateTime format
How can I display a DATETIME value (2010-12-02 15:20:17.000) as 02/12-2010 15:20?
For SQL Server:
select stuff(convert(varchar, getdate(), 105), 3, 1, '/') + ' ' + left(convert(varchar, getdate(), 8), 5)
DateTime is a DateTime is a DateTime - it just holds a date and time and doesn't have any string representation, really.
See the CAST and CONVERT topic in the SQL Server Books Online for details - it shows all supported date formats that SQL Server supports.
For your source format (2010-12-02 15:20:17.000) you could probably use style no. 121
DECLARE @source VARCHAR(50) SET @source = '2010-12-02 15:20:17.000' DECLARE @Date DATETIME SELECT @Date = CONVERT(DATETIME, @source, 121) SELECT @Date
but your target format is a bit odd..... I don't see any "out of the box" style that would match your needs. You'll need to use some string manipulation code to get that exact format.