Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Time zone
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Computer systems == Many computer [[operating system]]s include the necessary support for working with all (or almost all) possible local times based on the various time zones. Internally, operating systems typically use [[Coordinated Universal Time|UTC]] as their basic [[system time|time-keeping standard]], while providing services for converting local times to and from UTC, and also the ability to automatically change local time conversions at the start and end of daylight saving time in the various time zones. (See the article on [[Daylight saving time#Computing|daylight saving time]] for more details on this aspect.) Web servers presenting web pages primarily for an audience in a single time zone or a limited range of time zones typically show times as a local time, perhaps with UTC time in brackets. More internationally oriented websites may show times in UTC only or using an arbitrary time zone. For example, the international English-language version of CNN includes GMT and Hong Kong Time,<ref>{{cite web |url=http://edition.cnn.com |title=International CNN |publisher=CNN |access-date=December 5, 2011 |archive-date=March 10, 2018 |archive-url=https://web.archive.org/web/20180310195324/https://edition.cnn.com/ |url-status=live }}</ref> whereas the US version shows [[Eastern Time Zone|Eastern Time]].<ref>{{cite web |url=http://www.cnn.com |title=United States CNN |publisher=Cnn.com |access-date=December 5, 2011 |archive-date=September 11, 2001 |archive-url=https://web.archive.org/web/20010911200318/http://www.cnn.com/ |url-status=live }}</ref> US Eastern Time and [[Pacific Time Zone|Pacific Time]] are also used fairly commonly on many US-based English-language websites with global readership. The format is typically based in the [[World Wide Web Consortium|W3C]] Note "datetime". [[Email]] systems and other messaging systems ([[Internet Relay Chat|IRC chat]], etc.)<ref>{{cite web|url=https://wiki.ubuntu.com/BuildingCommunity/BookingUbuntuMeetingChannel|title=Guidelines for Ubuntu IRC Meetings|date=August 6, 2008<!-- 15:53:34-->|publisher=[[Canonical Ltd.]]|access-date=July 13, 2009|archive-date=February 25, 2011|archive-url=https://web.archive.org/web/20110225064621/https://wiki.ubuntu.com/BuildingCommunity/BookingUbuntuMeetingChannel|url-status=live}}</ref> time-stamp messages using UTC, or else include the sender's time zone as part of the message, allowing the receiving program to display the message's date and time of sending in the recipient's local time. [[Database]] records that include a time stamp typically use UTC, especially when the database is part of a system that spans multiple time zones. The use of local time for time-stamping records is not recommended for time zones that implement daylight saving time because once a year there is a one-hour period when local times are ambiguous. [[Calendaring software|Calendar systems]] nowadays usually tie their time stamps to UTC, and show them differently on computers that are in different time zones. That works when having telephone or internet meetings. It works less well when travelling, because the calendar events are assumed to take place in the time zone the computer or smartphone was on when creating the event. The event can be shown at the wrong time. For example, if a New Yorker plans to meet someone in Los Angeles at 9 am, and makes a calendar entry at 9 am (which the computer assumes is New York time), the calendar entry will be at 6 am if taking the computer's time zone. Calendaring software must also deal with [[daylight saving time]] (DST). If, for political reasons, the begin and end dates of daylight saving time are changed, calendar entries should stay the same in local time, even though they may shift in UTC time. === Operating systems === ==== Unix ==== {{Main|Unix time}} [[Unix-like]] systems, including [[Linux]] and [[macOS]], keep system time in [[Unix time]] format, representing the number of seconds that have elapsed since 00:00:00 [[Coordinated Universal Time]] (UTC) on Thursday, January 1, 1970, excluding [[leap second]]s.<ref name="single-unix-spec-4.16">{{cite web|url=http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_16|title=The Open Group Base Specifications Issue 7, section 4.16 Seconds Since the Epoch|publisher=[[The Open Group]]|access-date=January 22, 2017|archive-date=December 22, 2017|archive-url=https://web.archive.org/web/20171222113543/http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_16|url-status=live}}</ref> Unix time is usually converted to local time when displayed to the user, and times specified by the user in local time are converted to Unix time. The conversion takes into account the time zone and daylight saving time rules; by default the time zone and daylight saving time rules are set up when the system is configured, though individual processes can specify time zones and daylight saving time rules using the ''TZ'' [[environment variable]].<ref name="tzset(3)">{{man|sh|tzset|SUS}}</ref> This allows users in multiple time zones, or in the same time zone but with different daylight saving time rules, to use the same computer, with their respective local times displayed correctly to each user. Information about time zones and daylight saving time rules most commonly comes from the [[IANA time zone database]]. Many systems, including anything using the [[GNU C Library]], a C library based on the [[BSD]] C library, or the [[System V Release 4]] C library, can make use of the IANA time zone database. ==== Microsoft Windows ==== [[Microsoft Windows|Windows]]-based computer systems prior to [[Windows 95]] and [[Windows NT]] used local time, but Windows 95 and later, and Windows NT, base system time on UTC.<ref>{{cite web|url=http://msdn2.microsoft.com/en-us/library/ms724961.aspx|title=System Time|website=[[MSDN]]|archive-url=https://web.archive.org/web/20070227230411/http://msdn2.microsoft.com/en-us/library/ms724961.aspx|archive-date=2007-02-27|url-status=dead}}</ref><ref>{{cite web|url=https://learn.microsoft.com/en-us/windows/win32/sysinfo/system-time|title=System Time|website=[[Microsoft Learn]]|date=January 7, 2021|access-date=April 23, 2024|archive-date=February 24, 2024|archive-url=https://web.archive.org/web/20240224224835/https://learn.microsoft.com/en-us/windows/win32/sysinfo/system-time|url-status=live}}</ref> They allow a program to fetch the system time as UTC, represented as a year, month, day, hour, minute, second, and millisecond;<ref>{{cite web|url=http://msdn2.microsoft.com/en-us/library/ms724390.aspx|title=GetSystemTime|website=MSDN|archive-url=https://web.archive.org/web/20070228030857/http://msdn2.microsoft.com/en-us/library/ms724390.aspx|archive-date=2007-02-28|url-status=dead}}</ref><ref>{{cite web|url=https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtime|title=GetSystemTime function (Windows)|website=Microsoft Learn|date=February 22, 2024|access-date=April 23, 2024|archive-date=April 23, 2024|archive-url=https://web.archive.org/web/20240423071349/https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtime|url-status=live}}</ref> Windows 95 and later, and Windows NT 3.5 and later, also allow the system time to be fetched as a count of 100 ns units since 1601-01-01 00:00:00 UTC.<ref>{{cite web|url=http://msdn2.microsoft.com/en-us/library/ms724397.aspx|title=GetSystemTimeAsFileTime|website=MSDN|archive-url=https://web.archive.org/web/20070224215258/http://msdn2.microsoft.com/en-us/library/ms724397.aspx|archive-date=2007-02-24|url-status=dead}}</ref><ref>{{cite web|url=https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime|title=GetSystemTimeAsFileTime function (Windows)|website=Microsoft Learn|date=February 22, 2024 |access-date=April 23, 2024}}</ref> The [[Windows Registry|system registry]] contains time zone information that includes the offset from UTC and rules that indicate the start and end dates for daylight saving in each zone. Interaction with the user normally uses local time, and application software is able to calculate the time in various zones. [[Remote Desktop Services|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 === ==== Java ==== While most application software will use the underlying operating system for time zone and daylight saving time rule information, [[Java (programming language)|the Java Platform]], from version 1.3.1, has maintained its own database of time zone and daylight saving time rule information. This database is updated whenever time zone or daylight saving time rules change. [[Oracle Corporation|Oracle]] provides an updater tool for this purpose.<ref>{{cite web |url=https://www.oracle.com/java/technologies/javase/tzupdater-readme.html |title=Timezone Updater Tool |publisher=Oracle Java Technologies |access-date=November 21, 2024}}</ref> As an alternative to the information bundled with the Java Platform, programmers may choose to use the Joda-Time library.<ref>{{cite web |url=http://joda-time.sourceforge.net/ |title=Joda-Time |publisher=Joda-time.sourceforge.net |access-date=December 5, 2011 |archive-date=December 3, 2011 |archive-url=https://web.archive.org/web/20111203213457/http://joda-time.sourceforge.net/ |url-status=live }}</ref> This library includes its own data based on the IANA time zone database.<ref>{{cite web |url=http://www.twinsun.com/tz/tz-link.htm |title=tz database |publisher=Twinsun.com |date=December 26, 2007 |access-date=December 5, 2011 |url-status=dead |archive-url=https://web.archive.org/web/20120623013511/http://www.twinsun.com/tz/tz-link.htm |archive-date=June 23, 2012 }}</ref> As of Java 8 there is a new date and time API that can help with converting times.<ref>{{Cite web|url=https://docs.oracle.com/javase/tutorial/datetime/|title=Trail: Date Time (The Javaβ’ Tutorials)|website=docs.oracle.com}}</ref> ==== JavaScript ==== Traditionally, there was very little in the way of time zone support for [[JavaScript]]. Essentially the programmer had 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 more complex daylight saving variations, such as divergent DST directions between northern and southern hemispheres. ECMA-402, the standard on Internationalization API for JavaScript, provides ways of formatting Time Zones.<ref>{{Cite web | title = ECMAScript 2015 Internationalization API Specification | publisher = ECMA International | date = June 2015 | access-date = September 4, 2019 | url = https://www.ecma-international.org/ecma-402/2.0/#sec-time-zone-names | archive-date = October 26, 2019 | archive-url = https://web.archive.org/web/20191026140400/https://www.ecma-international.org/ecma-402/2.0/#sec-time-zone-names | url-status = live }}</ref> However, due to size constraint, some implementations or distributions do not include it.<ref>{{Cite web | title = Internationalization Support | work = Node.js v12.10.0 Documentation | access-date = September 4, 2019 | url = https://nodejs.org/api/intl.html#intl_disable_all_internationalization_features_none | archive-date = August 28, 2019 | archive-url = https://web.archive.org/web/20190828234745/https://nodejs.org/api/intl.html#intl_disable_all_internationalization_features_none | url-status = live }}</ref> ==== Perl ==== The DateTime object in [[Perl]] supports all entries in the [[IANA time zone database]] and includes the ability to get, set and convert between time zones.<ref>{{cite web |url=https://metacpan.org/pod/DateTime |title=DateTime |publisher=METACPAN |access-date=April 14, 2014 |archive-date=March 29, 2014 |archive-url=https://web.archive.org/web/20140329001557/https://metacpan.org/pod/DateTime |url-status=live }}</ref> ==== PHP ==== The 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 time zone, and DateTime is aware of its own time zone internally. PHP.net provides extensive documentation on this.<ref>{{cite web |url=http://www.php.net/manual/en/book.datetime.php |title=DateTime |publisher=Php.net |access-date=December 5, 2011 |archive-date=November 22, 2011 |archive-url=https://web.archive.org/web/20111122174518/http://www.php.net/manual/en/book.datetime.php |url-status=live }}</ref> As noted there, the most current time zone database can be implemented via the [[PEAR#PECL|PECL]] timezonedb. ==== Python ==== The standard module datetime included with [[Python (programming language)|Python]] stores and operates on the time zone information class tzinfo. The third party pytz module provides access to the full IANA time zone database.<ref>{{cite web |url=http://pytz.sourceforge.net/ |title=pytz module |publisher=Pytz.sourceforge.net |access-date=December 5, 2011 |archive-date=November 30, 2011 |archive-url=https://web.archive.org/web/20111130085600/http://pytz.sourceforge.net/ |url-status=live }}</ref> Negated time zone offset in seconds is stored time.timezone and time.altzone attributes. From Python 3.9, the zoneinfo module introduces timezone management without need for third party module.<ref>{{cite web |url=https://docs.python.org/3/library/zoneinfo.html |title=zoneinfo module |publisher=www.python.org |access-date=February 8, 2021 |archive-date=February 7, 2021 |archive-url=https://web.archive.org/web/20210207193618/https://docs.python.org/3/library/zoneinfo.html |url-status=live }}</ref> ==== Smalltalk ==== Each [[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 two 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, Gemstone, or Dolphin.<ref>{{Cite web|url=http://www.chronos-st.org/|archiveurl=https://web.archive.org/web/20140405043602/http://www.chronos-st.org/|url-status=dead|title=chronos-st β Keeping up with time|date=October 21, 2024|archivedate=April 5, 2014}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)