javascript - postgresql to_timestamp returns different date than represented by the timestamp -
here's replication of problem:
i timestamp of via javascript as
var ts = +new date // 1368971991090 console.log( new date(1368971991090) ); // sun may 19 2013 13:59:51 gmt+0000 (gmt)
in postgres console, # select to_timestamp(1368971991090); to_timestamp -------------------------------- 45350-12-30 05:31:29.999872+00 (1 row)
a date way future.
the docs of javascript date#gettime
returns milliseconds starting epoch; same argument type postgres' to_timestamp
accepts. java's date#gettime
returns same value js date#gettime
.
quote postgresql doc link:
it accepts double precision argument , converts unix epoch (seconds since 1970-01-01 00:00:00+00) timestamp time zone.
key -
seconds since
and in js doc:
number of milliseconds since 1 january 1970 00:00:00 utc
Comments
Post a Comment