Contact Us 1-800-596-4880

date

date(parts: DateFactory): Date

Creates a Date value from values specified for year, month, and day fields.

Introduced in DataWeave version 2.4.0.

Parameters

Name Description

parts

Number values for year, month, and day fields. The month must be a value between 1 and 12, and the day value must be between 1 and 31. You can specify the name-value pairs in any order, but the output is ordered by default as a Date value, such as 2012-10-11. The input fields are parts of a DateFactory type.

Example

This example shows how to create a value of type Date.

Source

%dw 2.0
import * from dw::core::Dates
output application/json
---
{
   newDate: date({year: 2012, month: 10, day: 11})
}

Output

{
   "newDate": "2012-10-11"
}