---
schema_version: "1"
id: 30027d69b888934af0a1cd262687890b6d6f4c8c7ed3fc5d6ac52d2fd88dcc38
title: localDateTime
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.11/dw-dates-functions-localdatetime.md
canonical_url: https://docs.mulesoft.com/dataweave/2.11/dw-dates-functions-localdatetime
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 4b472959895e187161cddc74aa8f097a8f434493c66f6b7acc87fe12a1004b75
description: MuleSoft Documentation Site
release: "2.11"
latest: false
---
---
product: DataWeave
version: 2.11
---

# localDateTime

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

## localDateTime(parts: LocalDateTimeFactory): LocalDateTime

Creates a `LocalDateTime` value from values specified for `year`, `month`, `day`, `hour`, `minutes`,
and `seconds` fields.

_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>parts</code></p></td><td><div><div><p><code>Number</code> values for <code>year</code>, <code>month</code>, <code>day</code>, <code>hour</code>, <code>minutes</code>, and <code>seconds</code> fields. Valid values are numbers between 1 and 12 for the <code>month</code>, 1 through 31 for the <code>day</code>, 0 through 23 for the <code>hour</code>, 0 through 59 for <code>minutes</code>, and 0 through 59 (including decimals, such as 59.99) for <code>seconds</code> fields. You can specify the name-value pairs in any order, but the output is ordered as a default <code>LocalDateTime</code> value, such as <code>2012-10-11T10:10:10</code>. The input fields are parts of a <code>LocalDateTimeFactory</code> type.</p></div></div></td></tr></tbody></table>

### Example

This example shows how to create a value of type `LocalDateTime`.

#### Source

```DataWeave
%dw 2.0
import * from dw::core::Dates
output application/json
---
{
    newLocalDateTime: localDateTime({year: 2012, month: 10, day: 11, hour: 12, minutes: 30, seconds: 40})
}
```

#### Output

```Json
{
   "newLocalDateTime": "2012-10-11T12:30:40"
}
```
