I am trying to convert a date in string format in UTC timezone into Australia/Sydney timezone. It seems to work for one value, but not the other, so I am a little confused
%dw 2.0
import * from dw::core::Strings
output application/json
var inputUtc1 = "2024-09-08T08:23:00Z"
var inputUtc2 = "2024-10-15T00:00:00Z"
fun format(d: DateTime) = d as String {format: "yyyy-MM-dd'T'HH:mm:ss"}
---
{
"a1" : (format(inputUtc1) >> "Australia/Sydney") as String {format: 'yyyy-MM-dd\'T\'HH:mm:ss'},
"a2" : (format(inputUtc2) >> "Australia/Sydney") as String {format: 'yyyy-MM-dd\'T\'HH:mm:ss'}
}
The output generated is:
{
"a1": "2024-09-08T18:23:00",
"a2": "2024-10-15T11:00:00"
}
The value against a1 seems to be correct, but it seems incorrect for a2
2024-10-15T00:00:00Z in UTC should convert into 2024-10-15T10:00:00
However it is converting it into 2024-10-15T11:00:00Z
I'm not sure why it works for one date and not the other? (I am trying this in playground.)