機械翻訳について

算術演算の例

このセクションの例は、日付、時間、または期間のデータ型で実行できる算術演算を示しています。

オペレータ 結果 説明

(+)

date("2016-12-25") + duration("P3Y2M6D")

date("2020-03-02")

2016-12-25の3年2ヶ月後および6日後の日付を返します。

(+)

date and time("2016-12-25T12:30:00Z") + duration("P1Y2M3DT10H30M")

date and time("2018-02-28T23:00:00Z")

日付と時刻を返します。2016-12-25の日付から1年2ヶ月3日10時間30分後12:30:00の時刻を返します。

(+)

date("2016-12-25") + duration("-P3Y2M6D")

date("2013-10-19")

2016-12-25の3年2ヶ月6日前の日付を返します。

(-)

date("2015-12-25") - date("2012-12-25")

duration("P1095DT0H0M0S")

日数と時間を示す期間を返します。

(-)

date and time("2012-12-25T12:00:00") - date and time("2015-12-25T11:12:00")

duration("-P1094DT23H12M0S")

日数と時間を示す期間を返します。

(-)

日付とtime("2012-12-25T12:00:00-08:00") - 日付とtime("2015-12-25T11:12:00Z")

duration("-P1094DT15H12M0S")

2つの異なるタイムゾーンの日時間の日数および時間を示す期間を返します。

(-)

date("2016-12-25") - duration("P3Y2M6D")

date("2013-10-19")

2016-12-25の3年2ヶ月6日前の日付を返します。

(/)

(date("2015-12-25") - date("2012-12-25"))/duration( "P1D" )

1095

2つの日付間の日数を返します。

(/)

(date and time("2015-12-25T17:00:00") - date and time("2015-12-25T09:12:00"))/duration( "PT1H" )

7.8

2つの日付と時刻の値の間の時間数を返します。

(/)

(date("2015-12-25") - date("2015-12-24"))/duration( "P1Y" )

0.0027397260273972603

2つの日付間の年数を返します。

なし

years and months duration(date("2012-12-23") , date("2015-12-25"))

duration("-P3Y0M")

2つの日付間の年と月の期間を返します。