Converting Bigint field (containing unixtime in millisecs) to TIMESTAMP
Hi all,
Database: MonetDB v11.19.9 (Oct2014-SP2)
I am trying to convert a big string fiel in a table containing unixtimes in millisecs to timestamps but i cannot find the right way to do it.
So my table descriptor:
TABLE "table" ( "user" VARCHAR(512), "time" BIGINT, [...] );
i tried to do
select CAST( CAST(time/1000 AS INTERVAL SECOND) AS TIMESTAMP) from table
;
types sec_interval(13,0) and timestamp(7,0) are not equal
And did not work, also using time in millisec the thing does not change. I know i am doing something wrong but i cannot get it.
Could you please advise me? :)
thx! Davide
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 02/03/15 13:36, Davide Magatti wrote:
Hi all,
Database: MonetDB v11.19.9 (Oct2014-SP2)
I am trying to convert a big string fiel in a table containing unixtimes in millisecs to timestamps but i cannot find the right way to do it.
So my table descriptor:
TABLE "table" ( "user" VARCHAR(512), "time" BIGINT, [...] );
i tried to do
select CAST( CAST(time/1000 AS INTERVAL SECOND) AS TIMESTAMP) from
table ;
types sec_interval(13,0) and timestamp(7,0) are not equal
And did not work, also using time in millisec the thing does not change. I know i am doing something wrong but i cannot get it.
Could you please advise me? :)
I guess you could add the interval to a timestamp: select cast(time/1000 as interval second) + timestamp '1970-01-01 00:00:00';
After all, an interval is a time *difference* and can therefore not be converted to a timestamp which is a *point in time*.
- -- Sjoerd Mullender
participants (2)
-
Davide Magatti
-
Sjoerd Mullender