英文:
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)
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)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论