Subject: International Standard Date Notation

From: [email-masked] (Markus Kuhn)
Date: 16 Jul 1995 10:09:12 GMT

International Standard Date Notation
------------------------------------

For those of you wondering, what the professional and correct way of
writing a calendar date in network publications is:

The international standard date notation is: YYYY-MM-DD

For example, February 4, 1995 is written as 1995-02-04. This notation
is standardized in International Standard ISO 8601. For a detailed
description of this standard, please download from ftp.uni-erlangen.de
the file pub/doc/ISO/ISO8601.ps.Z.

Other commonly used notations are e.g. 2/4/95, 4/2/95, 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 often and can
not be distinguished, it is unclear whether 2/4/95 means 1995-04-02 or
1995-02-04.

Advantages of the ISO standard date notation are:

  - easily parsable by software (no 'JAN', 'FEB', ... table necessary)
  - easily sortable with a trivial string compare
  - language independent
  - can not be confused with other popular date notations
  - consistent with 24-h time notation hh:mm:ss which comes also
    with the most significant component first and is consequently
    also easily sortable (e.g. write 1999-12-31 23:59:59).
  - short and has constant length (makes keyboard data entry easier)
  - identical to the Chinese date notation, so the largest cultural
    group (>25%) on this planet is already familiar with it.
  - 4-digit year representation avoids overflow problems after
    1999-12-31.

In shell scripts, use

  date "+%Y-%m-%d %H:%M:%S"

in order to print the date and time in ISO format. In C, use the
string "%Y-%m-%d %H:%M:%S" as the format specifier for strftime().

The beginning of the next century might be a good opportunity to
change to a common worldwide date notation. Feel free to redistribute
this text.

Markus

---
Markus Kuhn, Computer Science student -- University of Erlangen,
Internet Mail: <[email-masked]> - Germany
WWW Home: <http://wwwcip.informatik.uni-erlangen.de/user/mskuhn>

---

From: [email-masked] (John A. Dundas III)
Date: 17 Jul 1995 14:44:38 GMT

In article <[email-masked]>,
[email-masked] (Peter N. Schweitzer) writes:
|> In article <[email-masked]>,
|> [email-masked] (Markus Kuhn) writes:
|> >
|> > International Standard Date Notation
|> > ------------------------------------
|> >
|> > For those of you wondering, what the professional and correct way of
|> > writing a calendar date in network publications is:
|> >
|> > The international standard date notation is: YYYY-MM-DD
|> >
|> > For example, February 4, 1995 is written as 1995-02-04. This notation
|> > is standardized in International Standard ISO 8601. For a detailed
|> > description of this standard, please download from ftp.uni-erlangen.de
|> > the file pub/doc/ISO/ISO8601.ps.Z.
|> 
|> (very informative post truncated here)
|> 
|> > Markus Kuhn, Computer Science student -- University of Erlangen,
|> > Internet Mail: <[email-masked]> - Germany
|> > WWW Home: <http://wwwcip.informatik.uni-erlangen.de/user/mskuhn>
|> 
|> Unfortunately, the US Federal Information Processing Standards
|> include a date format that is significantly different, i.e.
|> YYYYMMDD (no hyphens).  Does anyone know whether US is planning
|> to revise the FIPS to match the ISO standard?

(Peter's signature deleted...)

Actually, I just happen to have a copy of the full ISO 8601 standard in front of
me and there are two different complete representations for calendar date.
Section 5.2.1.1 describes the "basic" format as CCYYMMDD, which corresponds
to Peter's example, and the "extended" format as CCYY-MM-DD, which is what
Markus noted.  Note that the standard says that BOTH are acceptable.  I say,
both are easily machine readable and distinguishable.

For time jockeys, this standard is an important one and should be studied carefully.
I highly recommend obtaining a (legitimate) copy and reading it often.

John Dundas

---

From: [email-masked] (Erik Naggum)
Date: 17 Jul 1995 14:53:40 GMT

[Peter N. Schweitzer]

|   Unfortunately, the US Federal Information Processing Standards
|   include a date format that is significantly different, i.e.
|   YYYYMMDD (no hyphens).  Does anyone know whether US is planning
|   to revise the FIPS to match the ISO standard?

the hyphens are optional in ISO 8601.  the FIPS should be updated to
include hyphens, as well.  (actually, ISO 8601 is way too permissive.)

my message-id has the compact form of ISO 8601, as in 19950717T144705Z,

#<Erik 3014981620>
-- 
NETSCAPISM /net-'sca-,pi-z*m/ n (1995): habitual diversion of the mind to
    purely imaginative activity or entertainment as an escape from the
    realization that the Internet was built by and for someone else.

---

From: [email-masked] (Dr John Stockton, NPL UK)
Date: Tue, 18 Jul 1995 10:23:28

In article <[email-masked]> [email-masked] (John A. Dundas III) writes:
>Actually, I just happen to have a copy of the full ISO 8601 standard in front 
of>me and there are two different complete representations for calendar date.
>to Peter's example, and the "extended" format as CCYY-MM-DD...

How should one do the date&time?  I have used 1995/07/18-10:22:49, but from 
the above I suspect that may not be the preferred punctuation.
-- 
John Stockton : [email-masked] from off-site.   MIME.   WP.
 National Physical Laboratory, Teddington, Middlesex, TW11 0LW, UK
  Direct Phone +44 181-943 6087, Nearby Fax +44 181-943 7138   
** Postings out, Email in/out are fast; News in is often slow. **
Offshore news takes 0..10+ days to arrive; please mail copies of 
replies!  Regret system puts unzoned (UK civil) time on messages.

---

From: Curtis Emerson
Date: 19 Jul 1995 19:47:17 GMT

Markus Kuhn writes
> International Standard Date Notation

Other older standards include 

ANSI X3.30,43,51 
CCSDS (Consultative Committee for Space Data Systems)
   http://ddwilson.gsfc.nasa.gov/CCSDS-A.html

Note that there is no RDBMS SQL standard for date/time format.

Would be nice if everyone adopted ISO format.

Curtis

---

From: [email-masked] (Markus Kuhn)
Date: 21 Jul 1995 14:48:25 GMT

>the above I suspect that may not be the preferred punctuation.

Replace the '/' by '-'. Usually, I separate the date and time fields by a
space, in case you need a non-space joiner for the two fields, ISO 8601
suggests a capital T:

  1995-07-18T10:22:49

I prefer

  1995-07-18 10:22:49

ISO 8601 defines a whole compatible family of date and time notations 
for various requirements. E.g. you can also write 19950718T102249
which is sometimes used in compact file formats. They are all automatically
distinguishable.

For details, please download from ftp.uni-erlangen.de the file
pub/doc/ISO/ISO8601.ps.Z or get a copy of ISO 8601.

Markus

---

---

From: [email-masked] (Markus Kuhn)
Date: 23 Jul 1995 10:53:35 GMT

>Would be nice if everyone adopted ISO format.

I have just checked the CCSDS publications. In the file

  <gopher://joy.gsfc.nasa.gov:70/00/CCSDS/CCSDS.Blue.Books/Text/
   Time_Code_Formats.txt>

there are both binary and ASCII date/time formats specified and the
ASCII versions are perfectly conforming to ISO 8601 (this standard is even
explicitely referenced).

The two ASCII variants from ISO 8601 used in this standard are:

---------------------------------------------------------------------------
2.5.1.1 ASCII TIME CODE A,  Month/Day of Month Calendar Variation:

The format for ASCII Time Code A is as follows:

     YYYY-MM-DDThh:mm:ss.d->dZ

[...]
2.5.1.2  ASCII TIME CODE B,  Year/Day of Year Calendar Variation:

The format for ASCII Time Code B is as follows:

     YYYY-DDDThh:mm:ss.d->dZ

---------------------------------------------------------------------------

E.g.  1988-01-18T17:20:43.123456Z (the Z after the time indicates
according to ISO 8601 that the time is in UTC (Z for ZERO meridian,
in international radio communication pronounced as "zulu" or "zulu time").

The second date format (YYYY-DDD) consists of the 4-digit year and the 3-digit
day number in the year (values 001 - 365 or 366 in leap years) which
is preferred over year-month-day in some organizations.

E.g. 1988-01-18 = 1988-018

Markus

---

---

From: [email-masked] (the ideal copy)
Date: Fri, 28 Jul 1995 13:58:05 GMT

In article <[email-masked]>, [email-masked] (Erik Naggum) wrote:
> [John A. Dundas, III]
> |   calendar date.  Section 5.2.1.1 describes the "basic" format as
> |   CCYYMMDD, which corresponds to Peter's example, and the "extended"
> |   format as CCYY-MM-DD, which is what Markus noted.  Note that the
> |   standard says that BOTH are acceptable.  I say, both are easily machine
> |   readable and distinguishable.
> 
> sorry to say so, John, but you point out what the real problem is.  a
> century (CC) is not a distinct part of a date specification, it's an
> integral part of the year.  likewise, we don't say CCDYMMdd, D for Decadem
> we say YYYYMMDD.

What's more, today is 1995-07-28, but it's in the 20th century.

But 2000-07-28 is in the 20th century as well, as the 21st century doesn't
start until January 1st 2001.

So calling the first two digits of the year the "century" is really very
misleading. Every time I see someone do it, I think "Ah, there's a person
who doesn't really know what's going on."

mathew
-- 
the ideal copy is the same, the ideal copy has your name
when you can't it makes you can, when you aren't it makes you am

http://www.mantis.co.uk/~mathew/

---

From: [email-masked] (John A. Dundas III)
Date: 31 Jul 1995 19:58:00 GMT

In article <[email-masked]>
 [email-masked] (the ideal copy) writes:
|> In article <[email-masked]>, [email-masked] (Erik Naggum) wrote:
|> > [John A. Dundas, III]
|> > |   calendar date.  Section 5.2.1.1 describes the "basic" format as
|> > |   CCYYMMDD, which corresponds to Peter's example, and the "extended"
|> > |   format as CCYY-MM-DD, which is what Markus noted.  Note that the
|> > |   standard says that BOTH are acceptable.  I say, both are easily machine
|> > |   readable and distinguishable.
|> > 
|> > sorry to say so, John, but you point out what the real problem is.  a
|> > century (CC) is not a distinct part of a date specification, it's an
|> > integral part of the year.  likewise, we don't say CCDYMMdd, D for Decadem
|> > we say YYYYMMDD.
|> 
|> What's more, today is 1995-07-28, but it's in the 20th century.
|> 
|> But 2000-07-28 is in the 20th century as well, as the 21st century doesn't
|> start until January 1st 2001.
|> 
|> So calling the first two digits of the year the "century" is really very
|> misleading. Every time I see someone do it, I think "Ah, there's a person
|> who doesn't really know what's going on."

Gee, and here I thought I was contributing a useful point to an interesting
discussion (rather than making a personal assault on another individual's intelligence).

At the risk of violating some international copyright treaty, here is the direct
quote from 5.2.1.1 (page 4, for those playing along at home):

"5.2.1.1 Complete representation

When the application clearly identifies the need for an expres-
sion only of a calendar date, then the complete representation
shall be a single numeric data element comprising eight digits,
where [CCYY] represents a calendar year, [MM] the ordinal
number of a calendar month within the calendar year, and [DD]
the ordinal number of a day within the calendar month.

    Basic format: CCYYMMDD

        Example: 19850412

    Extended format: CCYY-MM-DD

        Example: 1985-04-12"

Before making any more comments regarding my ability to distinguish what is
and is not "going on" READ THE DOCUMENT.  It's not my opinion; it's an ISO
standard that I had nothing to do with.