patternsqlMinor
What function to use with this timestamp?
Viewed 0 times
thiswhatwithfunctiontimestampuse
Problem
I have timestamp (stored as BIGINT) format I cannot turn into a human-readable format:
It points to a date in 2016-may-11th. However function to_timestamp() turns this into:
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.
1462975819250It points to a date in 2016-may-11th. However function to_timestamp() turns this into:
48329-11-10 13:00:49.999872+01I'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.
Solution
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+02Code Snippets
SELECT to_timestamp(1462975819.250);Context
StackExchange Database Administrators Q#138315, answer score: 8
Revisions (0)
No revisions yet.