Time Zones

CFDate objects are all expressed as Greenwich Mean Time, or GMT. In order to convert a GMT date to your local time you must use a CFTimeZone object. A CFTimeZone represents a geopolitical region that has some temporal offset, either plus or minus, from GMT as well as an abbreviation—such as “PST”. In addition to familiar abbreviations, time zones are also named by country and region. For example the United States spans these times zones:

To make matters even more complex, any region may or may not be on Daylight Savings Time (DST).

In order to properly convert GMT to local time, you have to know which time zone you are in and if DST is in effect. Core Foundation uses time zone names, abbreviations, GMT offset, and DST information for a particular time zone obtained from a public-domain database maintained at ftp://elsie.nci.nih.gov//pub/. This database contains information representing the history of local time for many representative locations around the globe. The database is updated periodically to reflect changes made to GMT offsets and daylight-saving rules by political entities.

For examples of how to use CFDate and CFTimeZone, see the Using Dates.