時刻と持続期間の比較

時刻と持続期間を比較して、ある時刻の前または後の特定の瞬間に何かが発生することをテストします。

以下の演算子を使用して、時刻と持続期間を比較します。
  • <duration> before <date>
  • <duration> after <date>
時刻は、規則的な時間目盛りで期間と比較することができます。例えば、購入イベント時刻の、正確に 7 日前の時刻は、次のいずれかの方法で表すことができます。
  • 7 days before 'the purchase event'
  • 1 week before 'the purchase event'

時刻は、不規則な時間目盛りで持続期間と比較することができます。例えば、3 months before the launch date of 'the product' などとなります。製品が 2013 年 2 月 14 日に発売された場合、このルールは 2012 年 11 月 14 日を返します。

また、より複雑な形式のカレンダー持続期間を引いたり足したりすることもできます。例えば、2 months 1 week 2 days before the launch date of 'the product' などとなります。

以下のルールは、購入イベント (purchase event) が、フライト出発 (departure time) の 2 時間以上後に発生するかどうかをチェックします。

when a purchase event occurs
definitions
    set 'the departure time' to a flight departure event;
if
    this purchase event is after 2 hours after 'the departure time'
then
    print "A passenger made a purchase more than 2 hours after the flight departure.";

時刻は、もう 1 つの時刻までの時間間隔によって定義することもできます。時間間隔は、絶対持続期間で指定されます。