← dateadd operator page · time/dateadd/ds/shifts_the_time_identifier
pandas ✅ · DuckDB ✅
dateadd(DS_1, 1, "M"), the page's valid syntax DS_r := dateadd(DS_1, 1, “M”), on a dataset whose one time component is the date identifier Id_2.
Add time unit to date: the operand is dataset{ identifier < time > _ , identifier _* }, and "the result Data Set has the same Identifier, Measure and Attribute Components as the operand Data Set". The type names no time measure, only the time identifier, so Id_2 moves and Me_1 is kept; the page does not say it in words, and DS_1 allows no other reading.
One month later, keeping the day as "dateadd (2020-02-10, 1, “M”) gives 2020-03-10": 2019-02-15 and 2020-03-10, every component keeping its type.
DS_r := dateadd(DS_1, 1, "M");
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| A | 2019-01-15 | 10 |
| B | 2020-02-10 | 20 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "Date", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| A | 2019-02-15 | 10 |
| B | 2020-03-10 | 20 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "String", "role": "Identifier"},
{"name": "Id_2", "type": "Date", "role": "Identifier"},
{"name": "Me_1", "type": "Integer", "role": "Measure"}
]
}
]
}