Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

[sci.astro] Time (Astronomy Frequently Asked Questions) (3/9)
Section - C.01 When is 02/01/04? or is there a standard way of writing dates?

( Part0 - Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Counties ]


Top Document: [sci.astro] Time (Astronomy Frequently Asked Questions) (3/9)
Previous Document: C.00 Time, Calendars, and Terrestrial Phenomena
Next Document: C.02 What are all those different kinds of time?
See reader questions & answers on this topic! - Help others by sharing your knowledge

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 more details
regarding  this standard, please
<URL:http://www.cl.cam.ac.uk/~mgk25/iso-time.html>. 

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 parsed 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 24h 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().

Other useful information on the ISO standard is at <URL:
http://dmoz.org/Science/Reference/Standards/Individual_Standards/ISO_8601/
>.

User Contributions:

Comment about this article, ask questions, or add new information about this topic:




Top Document: [sci.astro] Time (Astronomy Frequently Asked Questions) (3/9)
Previous Document: C.00 Time, Calendars, and Terrestrial Phenomena
Next Document: C.02 What are all those different kinds of time?

Part0 - Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
jlazio@patriot.net





Last Update March 27 2014 @ 02:11 PM