on 2012 Dec 07 1:53 PM
How can I convert an Epoch timestamp to a timestamp using SQL Anywhere?
For example: Input Epoch timestamp: 1354320000
Desired output Timestamp: 2012-12-01 00:00:00
Human time (GMT): Sat, 01 Dec 2012 00:00:00 GMT
Mark your answer has the extra ".000000"
I think this is what I need to do, right?
--CONVERT FROM EPOCH TO DATETIME:
SELECT DATEFORMAT(dateadd(SS,CONVERT(INT, 1354320000), CAST('1970-01-01 00:00:00' as datetime) ), 'yyyy-mm-dd hh:mm:ss') as myDateTime;
---CONVERT FROM DATETIME TO EPOCH GMT+0:
SELECT CAST(datediff(ss, 'Jan 01 1970', '2012-12-01 00:00:00' ) AS CHAR) as myEpochDate;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
EPOC time is the number of seconds since 1970 Jan 1.... so use:
select dateadd( SECOND, 1354320000, '1970-1-1' )
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
71 | |
11 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.