intro blah blah time zones
include tz database somewhere...
along with technology other than internet/programming langs...
Internet
editUTC is often used on the Internet for meetings (i.e. IRC chats, news, shows and so on).[1] For e-mail, the sender time zone is used to calculate the send time, but this time is recalculated by the receiver mail client, and shown according to the receiver time zone.
On websites with mainly domestic audiences local time is often used, sometimes with UTC in brackets: e.g. the international English-language version of CNN includes GMT and Hong Kong Time,[2] whilst the US version shows Eastern Time.[3] US Eastern Time and Pacific Time are also used fairly commonly on many US-based English-language websites with global readership.
The format is based in the W3C Note "datetime".
Operating systems
editUnlike internet implementations, most modern computer operating systems include information about time zones, including the capability to automatically change the local time when daylight saving starts and finishes (see the article on daylight saving time for more details on this aspect).
Unix
editMost Unix-like systems, including Linux and Mac OS X, keep system time as UTC (Coordinated Universal Time). Rather than having a single time zone set for the whole computer, timezone offsets can vary for different processes. Standard library routines are used to calculate the local time based on the current timezone, normally supplied to processes through the TZ environment variable. This allows users in multiple timezones to use the same computer, with their respective local times displayed correctly to each user. Timezone information is most commonly stored in a timezone database known as tz database (or sometimes zoneinfo or Olson format). In fact, many systems, including anything using the GNU C Library, can make use of this database.
Microsoft Windows
editWindows-based computer systems normally keep system time as local time in a particular time zone. A system database of timezone information includes the offset from UTC and rules that indicate the start and end dates for daylight saving in each zone. Application software is able to calculate the time in various zones. Terminal Servers allow remote computers to redirect their time zone settings to the Terminal Server so that users see the correct time for their time zone in their desktop/application sessions. Terminal Services uses the server base time on the Terminal Server and the client time zone information to calculate the time in the session.
Programming languages
editJava
editWhile most application software will use the underlying operating system for timezone information, the Java Platform, from version 1.3.1, has maintained its own timezone database. This database will need to be updated whenever timezone rules change. Sun provides an updater tool for this purpose.[4]
As an alternative to the timezone information bundled with the Java Platform, programmers may choose to use the Joda-Time library.[5] This library includes its own timezone data based on the frequently updated tz database.[6]
Javascript
editThere is very little in the way of timezone support for Javascript. Essentially the programmer has to extract the UTC offset by instantiating a time object, getting a GMT time from it, and differencing the two. This does not provide a solution for daylight savings variations.
PHP
editThe DateTime objects and related functions have been compiled into the PHP core since 5.2. This includes the ability to get and set the default script timezone, and DateTime is aware of its own timezone internally. PHP.net provides extensive documentation on this.[7] As noted there, the most current timezone database can be implemented via the PECL timezonedb.
Python
editThe standard module datetime stores and operates on the timezone information class tzinfo. The third party pytz module provides access to the full tz database.[8]. Negated time zone offset in seconds is stored time.timezone and time.altzone attributes.
Smalltalk
editEach Smalltalk dialect comes with its own built-in classes for dates, times and timestamps, only a few of which implement the DateAndTime and Duration classes as specified by the ANSI Smalltalk Standard. VisualWorks provides a TimeZone class that supports up to 2 annually recurring offset transitions, which are assumed to apply to all years (same behavior as Windows time zones.) Squeak provides a Timezone class that does not support any offset transitions. Dolphin Smalltalk does not support time zones at all.
For full support of the tz database (zoneinfo) in a Smalltalk application (including support for any number of annually recurring offset transitions, and support for different intra-year offset transition rules in different years) the third-party, open-source, ANSI-Smalltalk-compliant Chronos Date/Time Library is available for use with any of the following Smalltalk dialects: VisualWorks, Squeak or Dolphin.
Databases
editSome databases allow storage of a datetime type having time zone information. The SQL standard defines two standard time data types:
- TIMESTAMP WITH TIME ZONE
- TIMESTAMP WITHOUT TIME ZONE
However, the standard has a somewhat naive understanding of time zones. It generally assumes a time zone can be specified by a simple offset from GMT. This causes problems when trying to do arithmetic on dates which span daylight saving time transitions or which span political changes in time zone rules.
Oracle
editOracle Database is configured with a database time zone, and connecting clients are configured with session time zones. Oracle Database uses two data types to store time zone information:
- TIMESTAMP WITH TIME ZONE
- Stores date and time information with the offset from UTC
- TIMESTAMP WITH LOCAL TIME ZONE
- Stores date and time information with respect to the dbtimezone (which cannot be changed so long as there is a column in the db of this type), automatically adjusting the date and time from the stored time zone to the client's session time zone.
PostgreSQL
editPostgreSQL uses the standard SQL data types but tries to impose an interpretation which avoids the problems described above.
- TIMESTAMP WITH TIME ZONE
- Stores date and time in UTC and converts to the client's local time zone (which could be different for each client) for display purposes.
- TIMESTAMP WITHOUT TIME ZONE
- Stores date and time without any conversion on input or output.
References
edit- ^ "Guidelines for Ubuntu IRC Meetings". Canonical Ltd. 2008-08-06 15:53:34.
{{cite web}}
: Check date values in:|date=
(help) - ^ International CNN
- ^ United States CNN
- ^ Timezone Updater Tool
- ^ Joda-Time
- ^ tz database
- ^ DateTime
- ^ pytz module