Contact Us 1-800-596-4880

time

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.

Parameters

Name Description

parts

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.

Example

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

Source

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

Output

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