Flex Gateway新着情報
Governance新着情報
Monitoring API ManagerFlex Gateway新着情報
Governance新着情報
Monitoring API Manager2.x
Mule 4
3.9
1.1
2.x
1.2
7.x
指定された時間数から Period (期間) 値を作成します。
この関数では、duration
関数を入力値に適用します。
DataWeave バージョン 2.4.0 で導入されました。
名前 | 説明 |
---|---|
|
整数または小数としての時間数。 正または負の数値が有効です。 |
次の例では、さまざまな入力での hours
の動作を示します。
DateTime (日時) 値および LocalTime (ローカル時刻) 値に対して時間数を加算および減算します。
また、小数値 4.555
を Period (期間) 形式 (PT4H33M18S
) に、整数 4
を Period (期間) 形式 (PT4H
) にも変換します。
hours(-1) + hours(2)
では秒数が返されます。
%dw 2.0
import * from dw::core::Periods
output application/json
---
{
nextHour: |2020-10-05T20:22:34.385Z| + hours(1),
previousHour: |2020-10-05T20:22:34.385Z| - hours(1),
threeHoursLater: |20:22| + hours(3),
addDecimalInput: |20:22| + hours(3.5),
decimalInputAsPeriod : hours(4.555),
fourHourPeriod : hours(4),
addNegativeValue: hours(-1) + hours(2)
}
DataWeave
{
"nextHour": "2020-10-05T21:22:34.385Z",
"previousHour": "2020-10-05T19:22:34.385Z",
"threeHoursLater": "23:22:00",
"addDecimalInput": "23:52:00",
"decimalInputAsPeriod": "PT4H33M18S",
"fourHourPeriod": "PT4H",
"addNegativeValue": 3600
}
Json