HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

What function to use with this timestamp?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
thiswhatwithfunctiontimestampuse

Problem

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.

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+02

Code Snippets

SELECT to_timestamp(1462975819.250);

Context

StackExchange Database Administrators Q#138315, answer score: 8

Revisions (0)

No revisions yet.