← daytomonth operator page · time/daytomonth/comp/manual_ex_2
pandas ✅ · DuckDB ✅
daytomonth(Me_1) inside calc: numbers of days to months and days.
Number days to duration, Example 2: "The operator daytomonth returns a duration having the following mask", \PM\MDD\D, with the months and days "according to ISO 8601 M = 30D".
The manual's durations, P8M0D, P24M4D and P35M6D, a String Me_2: 8 × 30, 24 × 30 + 4 and 35 × 30 + 6 days.
As in the page's Example 1, of daytoyear, the manual's output repeats Id_1 = G on its second data point, where DS_1 has H; the expected output has H.
#394: a Duration holds only a period indicator (A, S, Q, M, W, D), so the ISO 8601 durations that daytoyear and daytomonth return and yeartoday and monthtoday take are Strings.
DS_r:= DS_1[calc Me_2 := daytomonth(Me_1)];
| Id_1 | Me_1 |
|---|---|
| G | 240 |
| H | 724 |
| T | 1056 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| G | 240 | P8M0D |
| H | 724 | P24M4D |
| T | 1056 | P35M6D |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "String", "role": "Identifier"},
{"name": "Me_1", "type": "Integer", "role": "Measure"},
{"name": "Me_2", "type": "String", "role": "Measure"}
]
}
]
}