convert time to based on each timezone in KDB+

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

convert time to based on each timezone in KDB+

问题

timeStamp timeZone localTime
2022.10.06D08:56:00.508000000 "Europe/London" localTime to London
2022.10.06D08:56:00.508000000 "Australia/Sydney" localTime to Sydney
2022.10.06D08:56:00.508000000 "America/New York" localTime to New York

你可以使用以下代码将每个时区的时间戳转换为本地时间:

update localTime:{first (dxTZFromGMT[`$y;timeStamp])} each timeZone from table

请注意,这只能将时间戳转换为单个时区的本地时间。

英文:
timeStamp timeZone localTime
2022.10.06D08:56:00.508000000 "Europe/London" localTime to London
2022.10.06D08:56:00.508000000 "Australia/Sydney" localTime to sydney
2022.10.06D08:56:00.508000000 "America/New York" localTime to new york

I want to convert timeStamp of each timeZone to its local time.

update localTime:{first (dxTZFromGMT[`$y;timeStamp])} each timeZone from table

I am able to convert to only single timeZone

update localTime:{first (dxTZFromGMT[`$"Australia/Sydney";x])} each timeStamp from table

答案1

得分: 2

update localTime:first each dxTimeZone`$timeZone; timestamp from table

' form of each https://code.kx.com/q/ref/maps/#each

{show (x;y)}'[1 2 3;4 5 6]
1 4
2 5
3 6

英文:
update localTime:first each dxTimeZone'[`$timeZone; timestamp] from table

' form of each https://code.kx.com/q/ref/maps/#each

{show (x;y)}'[1 2 3;4 5 6]
1 4
2 5
3 6

huangapple
  • 本文由 发表于 2023年4月17日 15:41:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/76032743.html
匿名

发表评论

匿名网友

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

确定