简体   繁体   English

转换Unix时间戳-Spotfire分析师

[英]Convert Unix Timestamp - Spotfire Analyst

I'm importing SQL data into Spotfire Analyst. 我正在将SQL数据导入Spotfire Analyst。 All of the date and time fields are in the form of a Unix timestamp. 所有日期和时间字段均采用Unix时间戳的形式。 What's the best way to convert this into an actual date format that I can manipulate in Spotfire? 将其转换为可以在Spotfire中操作的实际日期格式的最佳方法是什么?

Utilizing a calculated column you can calculate the datetime based on the UNIX epoch. 利用计算列,您可以根据UNIX纪元计算日期时间。

We simply add our seconds to the DateTime of the UNIX epoch (JAN 01 1970 00:00:00 UTC) to get the result. 我们只需将秒数添加到UNIX纪元的DateTime(JAN 01 1970 00:00:00 UTC)即可得到结果。 Below is an example of the UNIX time when I started writing this post. 下面是我开始撰写本文时的UNIX时间示例。

DateAdd("second",1429733486,DateTime(1970,1,1,0,0,0,0))

The below is what should work for you: 以下是适合您的方法:

DateAdd("second",[UNIX_TIMESTAMP_COLUMN],DateTime(1970,1,1,0,0,0,0))

Keep in mind these dates produced will be in the UTC timezone as per the JAN 1 1970 epoch. 请记住,根据1970年1月1日的时间,这些日期将以UTC时区为准。 If you need them in your local time zone you may have to adjust accordingly with further DateAdd functions adding/subtracting time as per current conversions. 如果您在当地时区需要它们,则可能需要根据当前转换,通过进一步的DateAdd函数进行相应的调整,以增加/减少时间。 Also, if you observe daylight savings time you may need to add some extra case logic to handle that as well. 另外,如果您观察到夏令时,则可能还需要添加一些额外的案例逻辑来处理。

Please let me know if you have any questions or need further clarification. 如果您有任何疑问或需要进一步澄清,请告诉我。

In 7.0 and later you can use 在7.0及更高版本中,您可以使用

FromEpohTimeSeconds([UNIXDATE])

or 要么

FromEpohTimeMilliseconds([UNIXDATE])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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