Time date format - ISO8601

xiaoxiao2021-03-06  162

A Summary of the International Standard Date and Time NotaN

By Markus Kuhn

International Standard ISO 8601 specifies numeric representations of date and time. This standard notation helps to avoid confusion in international communication caused by the many different national notations and increases the portability of computer user interfaces. In addition, these formats have several important advantages for computer usage Compared to other traditional date and time notations. The Time Notation Described Here IS Almosty The De-Facto Standard in Almost All Countries and the date notation is becoming increasingly Popular.

Especially Authors Of Web Pages and Software Engineers Who Design User Interfaces, File Formats, And Communication Protocols Should Be Familiar with ISO 8601.

Contents: Date, Time of Day, Time Zone.

Date

The International Standard Date Notation IS

YYYY-MM-DD

WHERE YYYY IH YEAR In The Usual Gregorian Calendar, MM Is The Month of The Year of The Year of the Month Between 01 and 31.

For Example, The Fourth Day of February In The Year 1995 IS Written in The Standard Notation AS

1995-02-04

Other Commonly Used Notations Are Eg 2/4/95, 4/2.195, 95/2/4, 4.2.1995, 04-Feb-1995, 4-February-1995, And Many More. Especially The First Two Examples Are Dangerous, Because As Both Are Used Quite Offen In The US and Id Britain and Both Can not be distinguished, it is unclear WHETHER 2/4/95 Means 1995-04-02 OR 1995-02-04. The date notation 2 / 4/5 HAS At Least Six Reasonable Interpretations (Assuming That Only The Twentieth and Twenty-First Century Are Reasonable Candidates In Our Life Time).

Advantages of the ISO 8601 standard date notation compared to other commonly used variants: easily readable and writeable by software (no 'JAN', 'FEB', ... table necessary) easily comparable and sortable with a trivial string comparison language independent can not be confused with other popular date notations consistency with the common 24h time notation system, where the larger units (hours) are also written in front of the smaller ones (minutes and seconds) strings containing a date followed by a time are also easily comparable and Sortable (Eg Write "1995-02-04 22:45:00") The Notation IS SHORT AND HAS Constant Length, Which Makes Both Keyboard Data Entry and Table Layout Easier Identical To The Chinese Date Notation, So The Largest Cultural Group (> 25%) on this Planet is Already Familiar with it :-) Date Notations with the Order "Year, Month, Day" Are IN Addition Already Widely Used Eg in Japan, Korea, Hungary, Sweden, Finland, Denmark, And A Few Other Countries and people in th E u.s. are already used to at Least the "MONTH, DAY" Order a 4-Digit Year Representation Avoids Overflow Problems After 2099-12-31

AS Dates Will Look A Little Bit Strange Anyway Starting With 2000-01-01 (E.G. Like 1/1/0), IT Has Been Suggested That The Year 2000 IS An Excellent Opportunity To Change To The Standard Date Notation.

ISO 8601 is only specifying numeric notations and does not cover dates and times where words are used in the representation. It is not intended as a replacement for language-dependent worded date notations such as "24. Dezember 2001" (German) or "February 4, 1995 "(US English). ISO 8601 SHOULD HOWEVER BE Used to Replace Notations Such AS" 2/4/95 "and" 9.30 PM ".apart from the Recommended Primary Standard Notance YYYY-MM-DD, ISO 8601 Also Specifies A Number of Alternative Formats for use in Applications with Special Requirements. All of these Alternatives Can Easily and Automatically Be distinguished from each other:

The Hyphens Can Be ittedi Compactness of The Reresentation Is More Important Than Human Readability, for Example As in IN

19950204

For Situations Where Information About The Century Is Really Not Required, A 2-Digit Year NOT IS AVAILABLE:

95-02-04 OR 950204

IF Only The Month or Even ONLY The year is of intert:

1995-02 or 1995

In commercial and industrial applications (delivery times, production plans, etc.), especially in Europe, it is often required to refer to a week of a year. Week 01 of a year is per definition the first week that has the Thursday in this year, which is equivalent to the week that contains the fourth day of January. in other words, the first week of a new year is the week that has the majority of its days in the new year. Week 01 might also contain days from the previous year and the week before week 01 of a year is the last week (52 or 53) of the previous year even if it contains days from the new year. A week starts with Monday (day 1) and ends with Sunday (day 7 ). For example, the first week of the year 1997 lasts from 1996-12-30 to 1997-01-05 and can be written in standard notation as1997-w01 or 1997w01

The Week Notation Can Also Be Extended by a Number Indicating The Day of the Week. For Example, The Day 1996-12-31, Which Is The Tuesday (Day 2) of the first week of 1997, can also be written as

1997-W01-2 OR 1997W012

For Applications Like Industrial Planning WHERE MANY THINGS LIKE SHIFT ROTATION WHERE MANYD Per Week and knowing the week number and the day knowing the day of the month.brly.

An abbreviated version of the year and week number like

95w05

IS Sometimes Useful as a Compact Code Printed ON A Product That Indicates When It Has Been Manufactured.

The Iso Standard Avoids Explicitly Stating The Possible Range of Week Numbers, But this Can Easily Be Deduced from The Definition:

Theorem: Possible ISO week numbers are in the range 01 to 53. A year always has a week 52. (There is one historic exception: the year in which the Gregorian calendar was introduced had less than 365 days and less than 52 weeks.) Proof: Per definition, the first week of a year is W01 and consequently days before week W01 belong to the previous year and so there is no week with lower numbers Considering the highest possible week number, the worst case is a leap year like 1976. that starts with a Thursday, because this keeps the highest possible number of days of W01 in the previous year, ie 3 days. in this case, the Sunday of W52 of the worst case year is day number 4 51 * 7 = 361 and 361-366 = 5 Days of W53 Belong Still To this year, Which Guarantees That in the Worst Case Year Day 4 (Thursday) of W53 IS Not Yet in The next year, so a week number 53 is Possible. For Example, The 53 Weeks of the Worst Case Year 1976 Started with 1975-12-29 = 1976-W01-1 and ended with endh 1977-01-02 = 1976-w53-7. On the other hand, considering the lowest number of the last week of a year, the worst case is a non-leap year like 1999 that starts with a Friday, which ensures that the first three days of the year belong to the last week of THE CASE, The Sunday of Week 52 Would Be Day Number 3 52 * 7 = 367, IE Only The Last 367-365 = 2 Days of The W52 Reach Into The Next Year and Consequently, Even A Worst Year Like 1999 Has A Week W52 Including the days 1999-12-27 to 2000-01-02. qed

[The new 1999 version of the C programming language standard (ISO 9899) added in the strftime () function means to generate the ISO 8601 week notation. The author of this text developed a further proposal for a modernised clock and calendar API for C, which provides full proper treatment of leap seconds and timezones and fixes numerous other problems in the current C timing library functions. It also serves as a model for those who want to design clock library functions for other programming languages.] Both day and year are useful units of structuring time, because the position of the sun on the sky, which influences our lives, is described by them. However the 12 months of a year are of some obscure mystic origin and have no real purpose today except that people are used to having them (they do not even describe the current position of the moon). in some applications, a date notation is preferred that uses only the year and the day of the year between 001 and 365 (366 in leap years). T He Standard Notation for this Variant Repesenting The Day 1995-02-04 (That is day 035 of the year 1995) IS

1995-035 OR 1995035

Leap years are years with an additional day YYYY-02-29, where the year number is a multiple of four with the following exception: If a year is a multiple of 100, then it is only a leap year if it is also a multiple Of 400. for Example, 1900 Was Not a Leap Year, But 2000 is One.

Time of day

The International Standard Notation for The Time of Day Is

HH: mm: ss

where hh is the number of complete hours that have passed since midnight (00-24), mm is the number of complete minutes that have passed since the start of the hour (00-59), and ss is the number of complete seconds since the start of the minute (00-60). If the hour value is 24, then the minute and second values ​​must be zero. [The value 60 for ss might sometimes be needed during an inserted leap second in an atomic time scale like Coordinated Universal Time (UTC). A single leap second 23:59:60 is inserted into the UTC time scale every few years as announced by the International Earth Rotation Service in Paris to keep UTC from wandering away more than 0.9 s from the less constant astronomical Time scale Ut1 this defined by the actual rotation of the Earth.] an example of time is

23:59:59

Which represents the time one second before midnight.

As with the date notation, the seprating colons can also be omitted as in

235959

And the precision can be reduced by omitting the seconds or Both the seconds and minutes as in

23:59, 2359, or 23

IT is also Possible to Add Fractions of a second A Decimal Dot OR COMMA, for Instance The Time 5.8 MS Before Midnight Can Be Written AS

23: 59: 59.9942 or 235959.9942

As every day both starts and ends with midnight, the two notations 00:00 and 24:00 are available to distinguish the two midnights that can be associated with one date. This means that the following two notations refer to exactly the same point in time :

1995-02-04 24:00 = 1995-02-05 00:00

In Case An Unambiguous REPRESENTATION OF TIME IS Required, 00:00 IS Usually The Preferred Notation for Midnight And NOT 24:00. DIGITAL Clocks Display 00:00 and not 24:00.

ISO 8601 does not specify, whether its notations specify a point in time or a time period. This means for example that ISO 8601 does not define whether 09:00 refers to the exact end of the ninth hour of the day or the period from 09 : 00 to 09:01 or anything else The users of the standard must somehow agree on the exact interpretation of the time notation if this should be of any concern.If a date and a time are displayed on the same line, then always write. The date..................

A Remark for Readers from the u.s .:

The 24h time notation specified here has already been the de-facto standard all over the world in written language for decades. The only exception are a few English speaking countries, where still notations with hours between 1 and 12 and additions like "am" and "pm" are in wide use. The common 24h international standard notation is widely used now even in England (eg at airports, cinemas, bus / train timetables, etc.). Most other languages ​​do not even have abbreviations like "am" AND "PM" and the 12h Notation IS CERTAINLY TO WRIVER USED IN TIME. Even in the US, The Military and Computer Program Have Been Using The 24h Notation for a long time.

The old English 12H Notation Has Many Disadvantages Like:

IT Takes Somewhat More Time for Humans To Compare Two Times in 12H Notation. It is not clear, how 00:00, 12:00 and 24:00 Are Represented. Event CONTAIN ContraDicting Descriptions and a common quick fixed NOT DISTINGUISH BETWEEN 00:00 and 24:00 (Midnight at the start or end of a given day). it makes people iple set often believe That the next day starts at the overflow from "12:59 am" to "1:00 am" , which is a common problem not only when people try to program the timer of VCRs shortly after midnight. It is not easily comparable with a string compare operation. It is not immediately clear for the unaware, whether the time between "12:00 am / pm "and" 1:00 am / pm "Starts at 00:00 OR at 12:00, IE The English 12h Notation IS More Diffic Roof Understand.Please Consider T he 12h time to be a relic from the dark ages when Roman numerals were used, the number zero had not yet been invented and analog clocks were the only known form of displaying a time. Please avoid using it today, especially in technical applications! Even In The US, The Widely Respected Chicago Manual Of Style Now Recommends Using The International Standard Time Notance In Publications.

A Remark for Readers from German Speaking Country:

The German standard DIN 5008, which specifies typographical rules for German texts written on typewriters, was updated in 1996-05. The old German numeric date notations DD.MM.YYYY and DD.MM.YY have been replaced by the ISO date notations YYYY -Mm-dd and yy-mm-dd. Similarly, The Old German Time Notations HH.mm and hh.mm.ss Have Been Replaced by The ISO Notations HH: MM and HH: MM: S. Those New Notations Are Now Also mentioned in the latest edition of the Duden. The German alphanumeric date notation continues to be for example "3. August 1994" or "3. Aug. 1994". The corresponding Austrian standard has already used the ISO 8601 date and time notations before. Iso 8601 HAS BEEN Adopted As EUROPEAN Standard EN 28601 and is Therefore Now A Valid Standard in All Eu Countries and All Conflicting National Standards Have Been Changed Accordingly.

Time Zone

Without any further additions, a date and time as written above is assumed to be in some local time zone. In order to indicate that a time is measured in Universal Time (UTC), you can append a capital letter Z to a time as in

23: 59: 59z or 2359z

[The Z stands for the "zero meridian", which goes through Greenwich in London, and it is also commonly used in radio communication where it is pronounced "Zulu" (the word for Z in the international radio alphabet). Universal Time (sometimes also called "Zulu Time") was called Greenwich Mean Time (GMT) before 1972, however this term should no longer be used. Since the introduction of an international atomic time scale, almost all existing civil time zones are now related to UTC, which Is Slightly Different from The Old and now unused gmt.

The strings

hh: mm, hhmm, or hh

Can Be Added to the Time TO INDICATE THE USED LOCAL TIME ZONE IS HH HOURS AND MM Minutes Ahead of Utc. for Time Zones West of The Zero Meridian, Which Are Behind Utc, The Notation-HH: mm, - Hhmm, OR - HH

IS USED INSTEAD. FOR EXAMPLE, CENTRAL European Time (CET) IS 0100 and U.S./Canadian Eastern Standard Time (EST) IS-0500. The Following Strings All Indicate The Same Point Of Time:

12: 00Z = 13: 00 01: 00 = 0700-0500

There exists no international standard that specifies abbreviations for civil time zones like CET, EST, etc. and sometimes the same abbreviation is even used for two very different time zones. In addition, politicians enjoy modifying the rules for civil time zones, especially for daylight saving times, every few years, so the only really reliable way of describing a local time zone is to specify numerically the difference of local time to UTC. Better use directly UTC as your only time zone where this is possible and then you do not have TO WORRY About Time Zones And Daylight Saving Time Changes At ALL.

More Information about Time Zones

Arthur David Olson and others maintain a database of all current and many historic time zone changes and daylight saving time algorithms. It is available via ftp from elsie.nci.nih.gov in the tzcode * and tzdata * files. Most Unix time zone handling implementations are based on this package. If you want to join the tz mailing list, which is dedicated to discussions about time zones and this software, please send a request for subscription to tz-request at elsie.nci.nih.gov. you can Read Previous Discussion there...

Other Links About Date, Time, And Calendars

Some other interesting sources of information about date and time on the Internet are for example the Glossary of Frequency and Timing Terms and the FAQ provided by NIST, the Yahoo Science: Measurements and Units: Time link collection, the US Naval Observatory Server, the International Earth Rotation Service (IERS) (for time gurus only!), the Network Time Protocol (NTP), the time and calendar section of the USENET sci.astro FAQ, and the Calendar FAQ.This was a brief overview of the ISO 8601 standard , which covers only the most useful notations and includes some additional related information The full standard defines in addition a number of more exotic notations including some for periods of time The ISO 8601:.. 2000 standard itself can only be ordered on paper or as a PDF File on CD-ROM Either Via Iso's Web Site ONLINE OR

International Organization for StandardizationCase Postale 561, Rue de Varembéch-1211 Genève 20SwitzerlandPhone: 41 22 749 01 11FAX: 41 22 733 34 30Email: Sales At isocs.iso.ch

A more detailed online summary of ISO 8601 than this one is the text ISO 8601: 1988 Date / Time Representations available from http://hydracen.com/dx/iso8601.htm (PostScript, 16 kb, 5 pages) written by Gary Houston , now also available in HTML. Ian Galpin (G1SMD) proposes to use ISO 8601 as a Common Date-Time Standard for Amateur Radio. Steve Adams has written another web page about the ISO date format that is partially based on this text. Another summary Of ISO 8601 IS JUKKA Korpela's Pageso Listed In The Open Directory.

THE committee in charge of iso 8601 is iso tc 154 and the editor of the second edition ISO 8601: 2000 WAS

Louis Visser.

I wish To Thank Edward M. Reingold for developing The Fine GNU Emacs Calendar Functions, AS Well As Rich Wales, Mark Brader, Paul Eggert, and Others in the comp.std.internat, comp.protocols.time.ntp, and sci. . astro USENET discussion groups for valuable comments about this text Further comments and hyperlinks to this page are very welcome.Some journalists recently got interested in the international date and time format and reported about it Examples include.:

An article by

Jon G. Auerbach in 1999-06-01 Issue of The Wall Street Journal, Page A1.

IF you are a.......................

You Might Also Be Interested in The International Standard Paper Sizes Web Page.

Markus Kuhn Created 1995 - Last Modified 2001-11-10 - http://www.cl.cam.ac.uk/~mgk25/io-time.html

转载请注明原文地址:https://www.9cbs.com/read-128400.html

New Post(0)