Date and time algebra

From Cuis CookBook
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.