Search code examples
kdb

How to convert list of historical local timestamps to UTC in q kdb?


I have a list of historical timestamps specified in London local time (GMT/BST). How can I transform these into UTC timestamps?

local_times:(2019.04.17T20:00:00.000;2019.01.17T20:00:00.000);
expected_utc_times:(2019.04.17T19:00:00.000;2019.01.17T20:00:00.000);

Solution

  • If your machine timezone(local time) is GMT/BST then you can directly use gtime function.

    q) local_times:(2019.04.17T20:00:00.000;2019.01.17T20:00:00.000)
    q) gtime local_times
    q) 2019.04.17T19:00:00.000 2019.01.17T20:00:00.000 
    

    From other timezones, you can use the method listed here: https://code.kx.com/v2/kb/timezones/