← getmonth operator page · time/getmonth/comp/manual_ex_1
pandas ✅ · DuckDB ✅
getmonth(Me_1) inside calc, on three dates.
Extract time period, Example 1, output verbatim: "The operator getmonth returns the month of the given date/time period (between 1 and 12)."
Me_2 is 1, 7 and 12, Integers.
DS_r:= DS_1[calc Me_2 := getmonth(Me_1)];
| Id_1 | Me_1 |
|---|---|
| G | 2019-01-01 |
| H | 2019-07-01 |
| 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-01 | 1 |
| H | 2019-07-01 | 7 |
| T | 2020-12-31 | 12 |
{
"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"}
]
}
]
}