0

I have written a query to convert epoch to date conversion in Athena but the result is not expected

select from_unixtime(cast(epoch_values as bigint))as dates from mybdbase

result is :

dates
+54113-07-13 10:11:53.000
+54113-07-13 10:11:57.000

The year is shown in the above table, How to solve this?

Luuk
  • 12,245
  • 5
  • 22
  • 33
MonkeyDLuffy
  • 13
  • 1
  • 5
  • Below links can be helpful.. https://stackoverflow.com/questions/42927726/converting-unix-epoch-time-to-extended-iso8601 https://ahana.io/answers/how-do-i-convert-unix-epoch-time-to-a-date-or-something-more-human-readable-with-sql/ –  Mar 01 '22 at 10:38
  • Interested in seeing the current value of `epoch_values` ... – Luuk Mar 01 '22 at 10:41
  • 1632816120779 1632121233095 and so on like this i have lot of epoch numbers then what's the case to convert them to date – MonkeyDLuffy Mar 01 '22 at 10:46
  • It seems your `epoch_values` are a factor 1000 to high, try to divide them – Luuk Mar 01 '22 at 11:02

1 Answers1

0

Use this:

from_unixtime(event_timestamp/1000000)

You could validate the results with this page: https://www.epochconverter.com/

ahuemmer
  • 1,653
  • 9
  • 22
  • 29