Search code examples
kdb

How do I generate a list of times by minute in KDB?


Let's say I have two datetimespans:

s: 2019.06.06D11:00:00.000000000
e: 2022.03.01D23:53:00.000000000

What would be the cleanest way to get a list of every inclusive minute between these two? (casting to z might be easier).


Solution

  • This approach would be faster that looping:

    q)\ts a:s+0D00:01*til 1+"j"$(e-s)%0D00:01
    17 33555136
    q)\ts b:(e>)(+[00:01])\s
    1640 48195648
    q)a~b
    1b