Epoch time to Date time in palantir foundry

huangapple go评论49阅读模式
英文:

Epoch time to Date time in palantir foundry

问题

我有一个很长的列,列出了时代(我可以将其完美地转换为日期时间1

我尝试在Palantir中使用下面建议的代码来做同样的事情3

CAST(CAST((utc_column) AS TIMESTAMP) AS DATE)

但是我的Palantir中的轮廓分析将日期转换为55346-06-08。我也尝试了列编辑器,结果一样。你有什么办法可以将时代时间转换为正确的日期时间吗?

英文:

I have a long column which gives epoch (which i can convert to date time perfectly)

Epoch time to Date time in palantir foundry

I tried to do the same in palantir using below code as advised here.

CAST(CAST((utc_column) AS TIMESTAMP) AS DATE)

But my contour analysis in palantir converts the date as 55346-06-08. I tried the column editor too and it gave the same result. Any idea as to how can i convert epoch time to correct date time in Palantir?

答案1

得分: 0

The CAST AS TIMESTAMP assumes it's in seconds.
All you have to do is divide by 1000 before converting.
Your expression should be: CAST(CAST((utc_column/1000) AS TIMESTAMP) AS DATE)

英文:

UNIX time you have is given in milliseconds, the CAST AS TIMESTAMP assumes it's in seconds.
All you have to do is divide by 1000 before converting.

Your expression should be: CAST(CAST((utc_column/1000) AS TIMESTAMP) AS DATE)

huangapple
  • 本文由 发表于 2023年6月8日 09:43:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/76428085.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定