Convert date from long time postgres Convert date from long time postgres sql sql

Convert date from long time postgres


Per PostgreSQL docs:

SELECT *, to_timestamp(time_in_milli_sec / 1000) FROM mytable


SELECT timestamp 'epoch' + time_in_millisec * interval '1 ms'FROM   mytable;

See the manual here.


For milliseconds

SELECT timestamp 'epoch' + proyecto.fecha_inicio * interval '1 ms'from proyecto.proyectowhere proyecto.fecha_inicio is not null

For seconds

SELECT TIMESTAMP WITH TIME ZONE 'epoch' + 982384720 * INTERVAL '1 second';

In the manual : http://www.postgresql.org/docs/current/interactive/functions-datetime.html.

Line: .. "Here is how you can convert an epoch value back to a time stamp"..