← cast operator page · general/cast/duration_to_string/iso_8601_durations
pandas ✅ · DuckDB ✅
cast(Me_1, string) on a Duration measure, without a mask: the default format.
Type conversion: "From duration: the duration value is printed using the ISO-8601 representation for durations."
The inputs are the one-letter codes that vtlengine reads ("A Year", "M Month", "D Day" in the mask section), and one year, month and day are P1Y, P1M and P1D in ISO-8601.
DS_r := DS_1[calc Me_2 := cast(Me_1, string)];
| Id_1 | Me_1 |
|---|---|
| 1 | A |
| 2 | M |
| 3 | D |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Duration", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| 1 | A | P1Y |
| 2 | M | P1M |
| 3 | D | P1D |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Me_1", "type": "Duration", "role": "Measure"},
{"name": "Me_2", "type": "String", "role": "Measure"}
]
}
]
}