Programmer Reference : Time Zones : The DateAndTime class
The DateAndTime class
DateAndTime keeps track of the operating system’s current time zone in a new class variable called LocalTimeZone. This variable contains the timeZoneRuleSet for the default time zone to be used when creating new instances of DateAndTime. It is set on image startup to the timeZoneRuleSet specified by the host operating system. Refer to Time Zone Database for information on where the database is located and how to override the default.
Overriding default time zone
The singleton of the class EsTimeZoneDatabase is responsible for reading the zoneinfo data on demand and caching the results. It also determines the operating system’s current time zone when the Smalltalk image starts up and sets EsTimeZoneDatabase singleton defaultTimeZone and DateAndTime LocalTimeZone to the correct value.
It is possible, however, to have a VA Smalltalk image run in a time zone other than the one the host OS runs in. If your image is running in Raleigh, NC, new DateAndTime objects would by default have 'America/New_York' as their time zone. However, you can force all DateAndTime objects created in that image to default to the Tasmanian time zone by executing:
EsTimeZoneDatabase singleton defaultLocation: 'Australia/Tasmania'.
This piece of code looks up the timeZoneRuleSet for 'Australia/Tasmania' in zoneinfo, and then sets EsTimeZoneDatabase singleton defaultTimeZone and DateAndTime LocalTimeZone to the timeZoneRuleSet named 'Australia/Tasmania'. After this Smalltalk code has been executed, all DateAndTime instance creation methods, other than those that explicitly specify either offset or timeZoneName, will create DateAndTime objects with the timeZone instance variable set to the timeZoneRuleset named 'Australia/Tasmania'.
Note that misspelling a time zone name is an error.
 
Last modified date: 02/17/2021