← cast operator page · general/cast/string_to_date/iso_8601_dates
pandas ✅ · DuckDB ✅
cast(Me_1, date) on a String measure, without a mask: the default parsing.
Type conversion, "To date": "exactly four digits are consumed to determine the year", then a -, "exactly two digits are consumed to determine the month in the range 01-12", a - again, and "exactly two digits are consumed to determine the day of the month".
2020-01-15 and 2021-12-31. The inputs have no blanks for the conversion to remove.
DS_r := DS_1[calc Me_2 := cast(Me_1, date)];
| Id_1 | Me_1 |
|---|---|
| 1 | 2020-01-15 |
| 2 | 2021-12-31 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "String", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| 1 | 2020-01-15 | 2020-01-15 |
| 2 | 2021-12-31 | 2021-12-31 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Me_1", "type": "String", "role": "Measure"},
{"name": "Me_2", "type": "Date", "role": "Measure"}
]
}
]
}