KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ 0D infront of timespan Re: 0D infront of timespan

  • rocuinneagain

    Member
    January 13, 2022 at 12:00 am

    The day part is an integral portion of the datatype and will display by default.

     

    In a UI/display time it can be dropped if required:

    q)2_string .z.n /Atom "14:41:40.125906000" 
    q)2_/:string 2#.z.n /List "14:42:00.701751000" "14:42:00.701751000" 
    q)update 2_/:string time from ([] time:2#.z.n) 
    /Column in table 
    time 
    -------------------- 
    "14:42:38.625329000" 
    "14:42:38.625329000" 
    // All columns of timespan type in a table 
    q)dropDays:{c:where -16h=type each first x;$[count c;![x;();0b;c!{((/:;_);2;($:;x))}each c];x]} 
    q)dropDays ([] time:2#.z.n;b:1.1 1.2) 
    time b 
    ------------------------ 
    "14:47:37.376270000" 1.1 
    "14:47:37.376270000" 1.2