localTime(parts: LocalTimeFactory): LocalTime

Creates a LocalTime value from values specified for hour, minutes, and seconds fields.

Introduced in DataWeave version 2.4.0.


Name Description


Number values for hour, minutes, and seconds fields. Valid values are 0 through 23 for the hour, 0 through 59 for minutes, and 0 through 59 (including decimals, such as 59.99) for seconds fields. You can specify the name-value pairs in any order, but the output is ordered as a default LocalTime value, such as 10:10:10. The input fields are parts of a LocalDateTimeFactory type.


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


%dw 2.0
import * from dw::core::Dates
output application/json
  newLocalTime: localTime({ hour: 12, minutes: 30, seconds: 40})


   "newLocalTime": "12:30:40"

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!