date(parts: DateFactory): Date

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

Introduced in DataWeave version 2.4.0.


Name Description


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.


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


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


   "newDate": "2012-10-11"

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub
Submit your feedback!
Share your thoughts to help us build the best documentation experience for you!
Take our latest survey!