← cast operator page · general/cast/string_to_time/iso_8601_intervals
pandas ✅ · DuckDB ✅
cast(Me_1, time) on a String measure, without a mask: ISO-8601 intervals.
Type conversion: "To time: the input string is parsed, according to the ISO-8601 standard for time intervals, up to a precision of days, and the corresponding time value is returned."
2020-01-01/2020-06-30 and 2021-03-15/2021-03-20, a time written start/end, as vtlengine reads it. The inputs have no blanks for the conversion to remove.
DS_r := DS_1[calc Me_2 := cast(Me_1, time)];
| Id_1 | Me_1 |
|---|---|
| 1 | 2020-01-01/2020-06-30 |
| 2 | 2021-03-15/2021-03-20 |
{
"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-01/2020-06-30 | 2020-01-01/2020-06-30 |
| 2 | 2021-03-15/2021-03-20 | 2021-03-15/2021-03-20 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Me_1", "type": "String", "role": "Measure"},
{"name": "Me_2", "type": "Time", "role": "Measure"}
]
}
]
}