time(parts: TimeFactory): Time

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

Introduced in DataWeave version 2.4.0.


Name Description


Number values for hour, minutes, and seconds fields, and a TimeZone value for the timezone field. 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. The timezone must be a valid TimeZone value, such as |-03:00| You can specify the name-value pairs in any order, but the output is ordered as a default Time value, such as 10:10:10-03:00. The input fields are parts of a TimeFactory type.


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


%dw 2.0
import * from dw::core::Dates
output application/json
  newTime: time({ hour: 12, minutes: 30, seconds: 40 , timeZone: |-03:00|})


   "newTime": "12:30:40-03:00"

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!