Date and time algebra

From Cuis CookBook
Revision as of 20:25, 4 May 2025 by Nmingott (talk | contribs) (imported material)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Problem. You want to know what will be the weekday name of the day 1000 day in the future from now.

Solution. Cuis has a class Duration and is capable of doing dates algebra.

((DateAndTime now) + (Duration days: 1000)) dayOfWeekName .       "=> #Saturday "

Exercise. Explore the classes DateAndTime, Duration and what is nearby in the Browser.

Exercise. Find the distance in hours between your birth date and your mother's.