Date output format must NOT be converted to CHAR of any kind
Posted on 2011-03-08
I have a table where the dateformat is stored in a INT field (A Cisco CDR table).
I can convert the date to a more readable format via this conversion:
SELECT CONVERT(varchar(11), (DATEADD(hh, 2, DATEADD(s, dateTimeConnect, '19700101'))), 105) +' '+ CONVERT(varchar(11), (DATEADD(hh, 2, DATEADD(s, dateTimeConnect, '19700101'))), 108) AS start, FROM dbo.cdrdata
The output will look like this on my HTML (asp) page: 13-07-2010 (dd-mm-yyyy plus the stored TIME as well - the preferred dateformat in denmark).
My problem is that I'm not able to ORDER BY these dates since they are in some soft of CHAR format and not DATE format.
Is there another type of conversion where I get to keep the date format or is there another kind of order type where I get to list the dates ordered as dates?