← cast operator page · general/cast/time_to_date/single_day_intervals
pandas ✅ · DuckDB ✅
cast(Me_1, date) on a Time measure whose intervals start and end on the same day, an explicit cast without mask.
Type conversion: "From time to date: A date value is returned if the time value start and ends at the same date, otherwise an error is raised."
2020-01-15 and 2021-12-31; neither raises the error.
DS_r := DS_1[calc Me_2 := cast(Me_1, date)];
| Id_1 | Me_1 |
|---|---|
| 1 | 2020-01-15/2020-01-15 |
| 2 | 2021-12-31/2021-12-31 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Time", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| 1 | 2020-01-15/2020-01-15 | 2020-01-15 |
| 2 | 2021-12-31/2021-12-31 | 2021-12-31 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Me_1", "type": "Time", "role": "Measure"},
{"name": "Me_2", "type": "Date", "role": "Measure"}
]
}
]
}