Skip to content
Advertisement

How do I convert Timestamp (having milliseconds) to EPOCH in Redshift

How do I convert from timestamp (having milliseconds) to epoch

For E.g.,

Using EPOCH gives the same results for both the timestamps, even though they are different timestamps (different milliseconds)

Query-

I want different results as they have separate timestamps

Advertisement

Answer

Just don’t cast to bigint if you don’t want to lose the millisecond precision:

Demo on DB Fiddle:

epoch1        | epoch2       
:------------ | :------------
1571571827298 | 1571571827469
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement