MSSQL Date formats? from Iteger to date?
got a problem converting a date logged by Cisco in integer format to a proper date format.
The cisco date is logged as 1088706777 which should equate to 01 Jul 2004 13:32:57, and does this in the cisco system.
Now as I understand it this number should be the number of secons sins the 1/1/1970 and the following query will give you the date
DECLARE @mydate_sm DATETIME
SET @mydate_sm = '1/1/70 00:00:00'
select @mydate_sm + (((1088706777)/60/60)/24)
This resolves into the following date:
which is correct however the time are not there and only the date
Looks like you're using the wrong DBMS
OK in Oracle:
1 select to_char(to_date('01-JAN-1970')+(((1088706777)/60/60)/24),'DD-MON-YYYY HH24:MI:SS')
2* from dual
anybody know what to do on sql?
OK got it.
this did the trick:
SELECT convert( CHAR(23),DATEADD(second, 1088706777, '01-JAN-1970'),13)
SELECT DATEADD(second, 1088706777, '01-JAN-1970')
Last edited by jluckhoff; 07-02-2004 at 12:42 PM.
Click Here to Expand Forum to Full Width