Ian's Dolphin Smalltalk Pages
: DateAndTime and Duration

Overview

The DateAndTime and Duration packages contain my implementation of the ANSI standard definitions of the same name. They are reasonably complete although there are one or two areas which I was unsure of, TimeZones for example.

The package only contains the basic classes, there are no TimeAndDate presenters included. If you want to use these classes, but also need to expose them at the UI, it will probably be easier to use the normal Dolphin Date and Time classes for the UI and convert to DateAndTime in your model.

For full documentation on each method see the ANSI standard.

DateAndTime represents a Date, Time and offset (a Duration representing a time zone). The time is stored as a Fraction representing the number of seconds before or after 0000-12-31T00:00:00+00:00. Yes, I know there was really no year 0 but that's what ANSI uses - and it makes things much easier!. DateAndTime replicates, albeit with different selectors, most of the functionality provided by the TimeStamp class.

Duration represents a period of time so, unlike the Dolphin Time class, does not represent a Time of day. Adding two hours to a Duration of 23:00:00 answers a Duration of 25:00:00. Durations are stored using Fractions of second.

Many thanks to Richard Harmon for providing some additional methods for the packages.