Frage

KDB for mortals , so KDB can flexibly convert date to underlying day count.

Advanced: The underlying day count can be obtained by casting to int.

 `int$2000.02.01 
 31

This doesn't look correct to me , why convert Feb month yield 31 days ? or I am reading the document incorrectly

War es hilfreich?

Lösung

It yields the day count since the epoch date (2000.01.01) in kdb+.

Between 2000.01.01 to 2000.02.01, there are 31 days.

Andere Tipps

WookiKent's answer is correct. To add to this however, if you're looking for some date object type attributes to extract year, month, day as ints, the following may be helpful:

dateObject:{`date`year`month`day!x,"I"$"."vs string[x]}
dt:dateObject[2000.02.01]

q)dt[`date]
2000.02.01
q)dt[`year]
2000
q)dt[`month]
2
q)dt[`day]
1
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top