Contact Us 1-800-596-4880

toTimeZone

toTimeZone(str: String): TimeZone

Transform a String value into a TimeZone value.

Introduced in DataWeave version 2.4.0.

Parameters

Name Description

str

The String value to transform into a TimeZone value.

Example

This example shows how toTimeZone behaves with different inputs. It produces output in the application/dw format.

Source

%dw 2.0
import * from dw::util::Coercions
output application/dw
---
{
   toTimeZoneOffset: toTimeZone("-03:00"),
   toTimeZoneAbbreviation: toTimeZone("Z"),
   toTimeZoneName: toTimeZone("America/Argentina/Buenos_Aires")
}

Output

{
  toTimeZoneOffset: |-03:00|,
  toTimeZoneAbbreviation: |Z|,
  toTimeZoneName: |America/Argentina/Buenos_Aires|
}