Search code examples
kdb

how to get (mm.dd) from a Date(yyyy.mm.dd) in kdb?


I need to get the month and date(mm.dd) from Date(yyyy.mm.dd) column in a table.

Input: Table t -

    Date      
----------
2019.11.01
2019.10.31
2019.10.30

Expected Output:

Date       MonDate
------------------
2019.11.01 "11.01"
2019.10.31 "10.31"
2019.10.30 "10.30"

Below code works on atom but throws length error with update statement on table.

Date:2019.11.01;
5_string Date /- output -  "11.01"
"."sv(string(`mm$Date);string(`dd$Date)) / "11.1"
((string (`mm$Date)),(string (.)),(string (`dd$Date))) / "11.1"
update MonDate:(5_string Date) from t / 'length

Solution

  • update MonDate:5_'string Date from t