---
schema_version: "1"
id: 5ff7438202786f36682e330af0e633447be5d5bb07f69a31109d31967bdb82f9
title: toTimeZone
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.6/dw-coercions-functions-totimezone.md
canonical_url: https://docs.mulesoft.com/dataweave/2.6/dw-coercions-functions-totimezone
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 5cd70383bf541e8dce92048b508f0de327a5b80087297056f5cb24585d63a9a4
description: MuleSoft Documentation Site
release: "2.6"
latest: false
---
---
product: DataWeave
version: 2.6
---

# toTimeZone

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

## toTimeZone(str: String): TimeZone

Transform a `String` value into a `TimeZone` value.

_Introduced in DataWeave version 2.4.0._

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>str</code></p></td><td><p>The <code>String</code> value to transform into a <code>TimeZone</code> value.</p></td></tr></tbody></table>

### Example

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

#### Source

```DataWeave
%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

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