简体   繁体   中英

How to convert unix time into date in druid or apache-druid

I want to use date_diff function in @druid . Where my input will be to unix_timestamp .

Unix_timestamp = 1597689016000

I want this to be converted into a timestamp where I can find the difference between two times.

Also please tell me, what is fiction to difference of both timestamps.

Try using the from_unixtime function, it expects seconds, and your timestamp is in milliseconds so divide by thousand:

from_unixtime(CAST(Unix_timestamp /1000 as BIGINT))

Sorry just saw it was in Druid, that shold work in presot. In Druid there is this function:

MILLIS_TO_TIMESTAMP(Unix_timestamp )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM