---
schema_version: "1"
id: 99256e4a7862c3cad57e6a555e2fcc96bf58f40655e3303e8135f363fa4ebae7
title: toLocalTime
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.4/dw-coercions-functions-tolocaltime.md
canonical_url: https://docs.mulesoft.com/dataweave/2.4/dw-coercions-functions-tolocaltime
source_site: docs.mulesoft.com
content_type: documentation
content_hash: a0f252269d09497165c4c5186fad52a97be48dd778605987ed42d5c3abe65d09
description: MuleSoft Documentation Site
release: "2.4"
latest: false
---
---
product: DataWeave
version: 2.4
---

# toLocalTime

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

## toLocalTime(str: String, format: String | Null = null, locale: String | Null = null): LocalTime

Transforms a `String` value into a `LocalTime` value and accepts a format and locale.

_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>LocalTime</code> value.</p></td></tr><tr><td><p><code>format</code></p></td><td><p>The formatting to use on the <code>LocalTime</code> value. A <code>null</code> value has no effect on the <code>LocalTime</code> value. This parameter accepts Java character patterns based on ISO-8601. A <code>LocalTime</code> value, such as <code>22:15:30.000000</code>, has the format <code>HH:mm:ss.n</code>.</p></td></tr><tr><td><p><code>locale</code></p></td><td><p>Optional ISO 3166 country code to use, such as <code>US</code>, <code>AR</code>, or <code>ES</code>. A <code>null</code> or absent value uses your JVM default.</p></td></tr></tbody></table>

### Example

This example shows how `toLocalTime` behaves with different inputs.

#### Source

```DataWeave
%dw 2.0
import * from dw::util::Coercions
output application/json
---
{
   toLocalTimeEx: toLocalTime("23:57:59"),
   toLocalTimeEx2: toLocalTime("13:44:12.283","HH:mm:ss.n")
}
```

#### Output

```DataWeave
{
  "toLocalTimeEx": "23:57:59",
  "toLocalTimeEx2": "13:44:12.283"
}
```
