← dayofmonth operator page · time/dayofmonth/comp/leap_day_and_month_end
pandas ✅ · DuckDB ✅
dayofmonth(Me_1) inside calc, on a date in the middle of a month, the leap day of 2020 and the last day of a month.
Extract time period: "The operator dayofmonth returns the ordinal day within the month (between 1 and 31)."
Me_2 is 15, 29 and 31, Integers.
DS_r := DS_1[calc Me_2 := dayofmonth(Me_1)];
| Id_1 | Me_1 |
|---|---|
| G | 2019-01-15 |
| H | 2020-02-29 |
| T | 2020-12-31 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Date", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| G | 2019-01-15 | 15 |
| H | 2020-02-29 | 29 |
| T | 2020-12-31 | 31 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "String", "role": "Identifier"},
{"name": "Me_1", "type": "Date", "role": "Measure"},
{"name": "Me_2", "type": "Integer", "role": "Measure"}
]
}
]
}