Font size


toTimeoutInCalendar(units, amount)

Returns timeout, in model time units, which equals to the given amount of specified time units from current model date, e.g. toTimeoutInCalendar(DAY, 1) returns timeout in model time units from date() to the date() 1 day.
The result of this method also depends on the current model date (because of leap years, different month lengths, daylight saving time tweaks) and therefore this method shouldn't be used for initialization of any constants.
One of examples where this method should be used: A model scheduling an event occurring each day at fixed time (e.g. 8:00): this method will return correct timeout on each call (even when time is switched to daylight-saving mode) unlike day() which will always return timeout for 24 hours and may result in events scheduled at 7:00 or 9:00.
Name Description
units Defines the time units. Valid values:
  • HOUR
  • DAY
  • WEEK
  • YEAR
amount The number of time units (may be negative, in this case result will be also negative). The real value of type double.
Type Description
double Timeout, in model time units, which may be used e.g. to schedule an event in the given amount of specified time units.
How can we improve this article?