---
schema_version: "1"
id: 9895993b790bd7128c6fe8eb8a91b7fd7ff9b5bf7421f0743ef2c29b69e1a886
title: dateTime
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.11/dw-dates-functions-datetime.md
canonical_url: https://docs.mulesoft.com/dataweave/2.11/dw-dates-functions-datetime
source_site: docs.mulesoft.com
content_type: documentation
content_hash: a9641a294478fe91567e51d930411380eab8c9a2c4c6709be1b10e337bacc89c
description: MuleSoft Documentation Site
release: "2.11"
latest: false
---
---
product: DataWeave
version: 2.11
---

# dateTime

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

## dateTime(parts: DateTimeFactory): DateTime

Creates a `DateTime` value from values specified for `year`, `month`, `day`, `hour`, `minutes`,
`seconds`, and `timezone` 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 followed by a <code>TimeZone</code> value for the <code>timezone</code> field. 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 seconds. You can specify the name-value pairs in any order, but the output is ordered by default as a <code>DateTime</code> value, such as <code>2012-10-11T10:10:10-03:00</code>. The input fields are parts of a <code>DateTimeFactory</code> type.</p></div></div></td></tr></tbody></table>

### Example

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

#### Source

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

#### Output

```Json
{
   "newDateTime": "2012-10-11T12:30:40-03:00"
}
```
