«
Rule language supports DateTime Items
type | name | label | group | state |
---|---|---|---|---|
DateTime | DateOne | Date One | Dates | 1970-01-01T00:00:00+00:00 |
DateTime | DateTwo | Date Two | Dates | 2021-01-31T08:00:00+00:00 |
DateTime | DateThree | Date Three | Dates | 2021-01-31T14:00:00+06:00 |
DateOne << DateOne<operator> <operand>
initial | operator | operand | final | |
---|---|---|---|---|
1970-01-31T08:00:00+0200 | + | 600 | 1970-01-31T08:10:00.000+0200 | |
1970-01-31T08:00:00+0000 | - | 600 | 1970-01-31T07:50:00.000+0000 | |
1970-01-31T08:00:00+0000 | + | '00:05' | 1970-01-31T08:05:00.000+0000 | |
1970-01-31T08:00:00+0200 | - | '00:05' | 1970-01-31T07:55:00.000+0200 | |
1970-01-31T08:00:00+0000 | + | 20.minutes | 1970-01-31T08:20:00.000+0000 | |
1970-01-31T08:00:00+0000 | - | 20.minutes | 1970-01-31T07:40:00.000+0000 |
logger.info(DateTwo.<method>)
method | result | |
---|---|---|
sunday? | true | |
monday? | false | |
wday | 0 | |
utc? | true | |
month | 1 | |
zone | Z |
if DateTwo == DateThree
logger.info("Same date")
end
DateOne << Time.at(60 * 60 * 24).utc
logger.info((DateOne - <operand>).to_i)
operand | result | |
---|---|---|
'2021-01-31T07:00:00+00:00' | 7200 | |
Time.utc(2021, 1, 31, 7) | 7200 | |
DateTwo | 3600 |
case DateThree
when between('00:00'...'08:00')
logger.info('DateThree is between 00:00..08:00')
when between('08:00'...'16:00')
logger.info('DateThree is between 08:00..16:00')
when between('16:00'..'23:59')
logger.info('DateThree is between 16:00...23:59')
end
if between(DateOne...DateTwo).cover? '05:00'
logger.info('05:00 is between DateOne..DateTwo')
end
require 'java'
DateOne << ZonedDateTime.of(1999,12,31,0,0,0,0,ZoneId.of("UTC"))