lotus

previous page: 35  Is it possible to see the Moon landing sites?
  
page up: Astronomy FAQ
  
next page: 37 What are all those different kinds of time? (Astronomy)

36 When is 02/01/04? or is there a standard way of writing dates? (Astronomy)




Description

This article is from the Astronomy FAQ, by Joseph Lazio (jlazio@patriot.net) with numerous contributions by others.

36 When is 02/01/04? or is there a standard way of writing dates? (Astronomy)

By Markus Kuhn <Markus.Kuhn@cl.cam.ac.uk>

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/
>.

 

Continue to:













TOP
previous page: 35  Is it possible to see the Moon landing sites?
  
page up: Astronomy FAQ
  
next page: 37 What are all those different kinds of time? (Astronomy)