0

I'm trying to convert a column which has unixtime (ex 1542862806000) to regular DTS

select unix_timestamp(column_name) from table;

But i get error:

AnalysisException: No matching function with signature: unix_timestamp(BIGINT).

My column type is bigint

TheNewGuy
  • 559
  • 1
  • 10
  • 27

1 Answers1

1

You are looking for from_unixtime not unix_timestamp.

select from_unixtime(cast(column_name/1000 as bigint),'MMddyyyy') 
from table

unix_timestamp converts a date/date format string to a bigint representing the number of seconds since 1970-01-01 00:00:00 UTC.

from_unixtime takes a bigint input and converts it to the required date format.

Vamsi Prabhala
  • 48,685
  • 4
  • 36
  • 58