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

# 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"
}
```
