PostgreSQL – Function to Use with Timestamp in Java

javapostgresqltimestamp

I have timestamp (stored as BIGINT) format I cannot turn into a human-readable format:

1462975819250

It points to a date in 2016-may-11th. However function to_timestamp() turns this into:

48329-11-10 13:00:49.999872+01

I'd like to create a VIEW where I could display these values, don't know what function to use.

The field is written by a Java program (EclipseLink I presume). I don't have the source-code of the program.

Best Answer

to_timestamp() expects the parameter to be given in seconds. Your value is in miliseconds. Just divide it by 1000:

SELECT to_timestamp(1462975819.250);

gives 2016-05-11 16:10:19.25+02