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.


Name Description


Number values for year, month, day, hour, minutes, and seconds fields. Valid values are numbers between 1 and 12 for the month, 1 through 31 for the day, 0 through 23 for the hour, 0 through 59 for minutes, and 0 through 60 (not inclusive; the field accepts 59.99, for example) for seconds fields. You can specify the name-value pairs in any order, but the output is ordered as a default LocalDateTime value, such as 2012-10-11T10:10:10. The input fields are parts of a LocalDateTimeFactory type.


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


%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})


   "newLocalDateTime": "2012-10-11T12:30:40"

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub