DOCUMENT TITLE:   Various Date Standards.
 AUTHOR:           Ian Galpin.
 LAST REVISED:     1997-Feb-08.
 FORMATTING:       78 Characters per line 
 FILE NAME:        Y2KDAT.TXT
                          
                          
                          
   

Date Standards:
---------------

This document deals with Date and Time Standards, both as defined in ISO 8601
and the JULIAN DAY representation.

ISO 8601 is an International Standard that defines how dates and times should
be written. It is implemented throughout Europe as EN 28601 and in Britain as
BS EN 28601. In America it is an ANSI standard. It has existed since 1971.
It covers several different ways of expressing dates and times:
- Calendar Date (Year, Month, Day).
- Ordinal Day of Year (Year, Day Number).
- Year, Week Number, and Day of Week representation.

The most common date format is that for CALENDAR DATE. Basically to comply
with the 'full' ISO format for Gregorian Calendar Date you need to:
- Use 4-digit years when storing or printing dates.
- Use the order  Year-Month-Day  for the date, i.e. biggest first.
- Use leading zeroes on the digits 00 - 09 for the month and day numbers.
  (Although not defined in the standard, some people prefer to write the month
  as a 3-letter abbreviation, while still retaining the Year-Month-Day order).
- Always put the Date BEFORE the Time; and use the UT (~UTC/~GMT) time scale.
- Use the order  hours:minutes:seconds  for times.
- Use the 24-hour format for times (not the 12-hour am/pm).
- Use a leading zero on hour, minute and second for digits 00 - 09 inclusive.
- When printing dates and times use the '-' and ':' separators.
     e.g.  1996-12-31  23:59:59  is the last second of last year.
- When storing dates or times you can strip off the separators and store as a
  32-bit number, an ASCII string, packed BCD or whatever you like. Sort
  algorithms are also much easier with this YMD and HMS format.

ISO 8601 also has a definition for dates expressed in ORDINAL DAY OF YEAR
format. The 'full' standard requires:
- Usage of a 4-digit year for all storage and printing.
- Use the order Year-DayNumber.
- The day number is a 3-digit number from 001 for the first day of the year,
  through to 365 (366 in a leap year) for the last day of the year.
- Times are written as in the preceding paragraph.
- The last second of last year would be written as  1996-366 23:59:59

The last part of the ISO 8601 Standard covers WEEKS and DAYS OF THE WEEK. This
involves splitting the year into 52 or 53 weeks, and the week into 7 days. The
'full' ISO standard uses:
- A 4-digit year representation as before.
- Follow it with the letter W and then the 2-digit week number from 01 to 53.
  (The first week of the year includes the first Thursday of that year).
- Follow that with the Day Number from 1 to 7 (Monday is 1). 7F
  (Some people precede the day number with the letter D, to aid clarity though
  this is not defined in the standard).
- The last second of last year would be written as 1996-W52-2 23:59:59 as the
  year ended on a Tuesday (this may be written as 1996-W52-D2 by some people).

What are benefits of ISO 8601 ?
-------------------------------
- By using 4 digits for the year, software should transition from 1999-12-31
  to 2000-01-01 (or 1999-365 to 2000-001 and so on) with no problems.
- All formats in the standard have a clear left to right precedence across all
  the data elements, and rollover is from right to left. This also makes
  programming easier, uses simpler algorithms and increases the program speed.
- Using leading zeroes in all the date and time elements leads to fixed length
  records, so mistakes are easier to spot, and lists containing dates and
  times are easier to read because the data lines up neatly in to columns.
- Following the standard, data is internationally understood. It is portable.

Are there any variations within, or applied to, ISO 8601 ?
----------------------------------------------------------
The standard lays down a 'full' format for calendar date/time (e.g. the last
day of last year is 1996-12-31), and then also defines 'truncated' forms (as
in '96-12-31' says year 96 in any century, December 31st) and 'reduced
precision' (for example '1996-12' specifies only down to month level) formats.
The 'full' format is the most relevant here.
Likewise the 'Ordinal Day of Year' and 'Year, Week, and Day of Week' standards
also have truncated and reduced precision forms.

ISO 8601 has 'extended' and 'basic' formats for each definition. The
'extended' format includes the separators: e.g. 1996-12-31, but the 'basic'
format omits them: e.g. 19961231. The extended format is intended for human
reading, and the basic format is used for data storage (i.e. on hard disk) or
for data transmission.
This also applies to the 'Ordinal Day of Year' and the 'Year, Week, and Day of
Week' standards in a similar manner.

What are the disadvantages ?
----------------------------
Only one, that is that a date like 1996-12-31 may confuse at first glance, but
it takes very little getting used to. There are so many other advantages that
this becomes a minor disadvantage. It is easily overcome if date/time data on
screen has a 'yyyy-mm-dd hh:mm:ss' legend immediately above it. It is a
scientific standard after all, and it has been endorsed as a S.I. unit. The
non-ISO variant with the month as a 3-letter abbreviation also helps clarity.
The 'Ordinal Day of Year' and 'Year, Week, and Day of Week' standards have the
same problem, but it is a very minor problem. Other ways of specifying dates
suffer many more problems of ambiguity than those defined in ISO 8601.

Julian Day Representation:
--------------------------
There is another Date Format that can help with Date and Time problems. This
is the JULIAN DAY representation. It is not covered by the ISO 8601 standard,
but can be very useful when dealing with dates covering a large span of time.
There are two definitions for Julian Day, but both are equivalent.

The first definition for Julian Day is very simple, and is as follows:
- A count of the number of days since 'BC4713-Jan-01 12:00:00' ephemeris time,
  that is Local mid-DAY on the Greenwich Meridian.
- Note that there is no year zero in the BC/AD system; AD year 1 follows
  directly after BC year 1.
- A new Julian Day starts at MIDDAY UT. Time of day is expressed as a decimal
  fraction, with a maximum of about 6 or 8 digits after the decimal point.
- JD 0.0   BC4713-Jan-01 12:00 UT (No year Zero, year AD1 follows BC1).*

The Alternative Definition for Julian Day is as follows:
- Julian Day counts the number of days since the beginning of the year -4712.
- This system includes a Year Zero, so +1 follows 0 follows -1.
- A new Julian Day starts at mid-day UT as before.
- JD 0.0    -4712-Jan-01 12:00 UT (Includes Zero, +1 follows 0 follows -1).*

The Date/Time  'AD1975-Jan-01 06:00:00 UT' is  JD 2442413.75
The Date/Time  'AD1975-Jan-01 18:00:00 UT' is  JD 2442414.25
The Date/Time  'AD1979-Dec-31 00:00:00 UT' is  JD 2444238.50
The Date/Time  'AD1996-Aug-09 21:37:00 UT' is  JD 2450305.401
There have been almost two and a half million Julian Days since the system
started nearly seven thousand years ago.

* Note:  There is a problem with dates BC.
Astronomers INCLUDE the Year Zero so the order of the years runs as:
      -3   -2   -1    0   +1   +2   +3.
Historians do NOT include the year zero so instead you get:
      BC4  BC3  BC2  BC1  AD1  AD2  AD3.
So the year -584 to an Astronomer is the year BC585 to an Historian.
This affects leap year calculations.
These occurred in ASTRONOMICAL years   0   -4   -8  etc  but also
note that these are therefore HISTORICAL years  BC1  BC5  BC9  etc.

The Julian Day representation came into use during the 1800s, related to an
idea by Joseph Justus Scaliger in 1583. Scaliger categorised years based on
the 3 most important cycles used in Roman times; the 28-year solar cycle 'S'
(weekdays and calendar dates repeat), the 19-year cycle of Golden Numbers 'G'
(Moon phases repeat on same calendar dates), and the 15-year Roman Tax cycle
'T'. These 3 numbers give a unique combination for each year over 7980 years,
the 'Julian Period'. Year BC1 was known to be S 9, G 1, T 3. Extrapolating
back to S 1, G 1, T 1 resulted in the Base Date of BC4713 (or -4712) for the
Julian Day system. The system goes back far enough into the past such that
there are no recorded astronomical events before this JD base date.

AN IMPORTANT WARNING:
---------------------
Many (most!) computer manuals state the wrong definition for Julian Day. The
definition that most programmers think of as being Julian Day is actually
called 'Truncated Year with Ordinal Day of Year' (where the last day of last
year would be '96366'). See the references to the ISO 8601 Standard above.
These programs may have a problem with the year 2000, especially so if only a
2-digit year representation is used.

History of Calendars:
---------------------
The 'Julian Calendar' was originally established by Julius Caesar in the
year -45 [BC46]*. The Julian Calendar is a 365-day year of 12 months, every
fourth year is a leap year and has 366 days. It was refined to its final form
in the year +8 [AD8]. A Julian Date is a Date in the Julian Calendar and
should not be confused with a 'Julian Day' as defined above.

It was noticed in the next millennium that the Julian Calendar was slowly
drifting away from the correct date as shown by the stars, at a rate of about
3 days every 400 years. The 'Gregorian Calendar' added the '100' and '400'
leap-year rules (to the existing 4-year rule of the 'Julian Calendar') and
corrected the actual date by 'missing out' 10 days in the year 1582 in Roman
Catholic countries (or 11 days in the year 1752 as implemented in England).
The Gregorian Calendar says that if the year is divisible by 4 or 400 it is a
leap year. If it is divisible by 100 (but not 400) it is not a leap year.

You can extrapolate the Gregorian or Julian Calendar back to a well known
astronomical event and talk about the evening of Date  '-1203-Aug-08'  but
this pre-dates the Roman Empire (from where month names were originated), so
'August' did not exist then. It is far better to talk in terms of JD which
just numbers each day one at a time in sequence, and say the event happened at
JD 1281882.3842. A maximum of about 6 or 8 characters appear after the decimal
point, they really are just a fraction of a day and so bear no easy numerical
relation to seconds and minutes. 1 minute is 0.00069444 days. 9 minutes is
0.006250 days. Please remember that the 'Julian Day' Number and Dates in the
'Julian Calendar' are NOT the same system!

While you could say with certainty that a particular 'BC' event (an Eclipse,
or a particular lining up of planets) happened on a certain Julian Day
(because we know the orbital period of the objects involved and can step them
back or forwards for many thousands of days in to the past or future), you
would need to be very careful to then say that this was on BC1053-Mar-23 at
21:55 hours UT. There are just too many variables along the way to be able to
say this with certainty. And anyway, any old stone tablets that recorded this
event would not be talking in either of these terms, more likely in terms of
'in the third year of King Rameses' rule there did appear ..... '.

So, with several millennia of past confusion you can see why astronomers were
quick to settle on the Gregorian Calendar, an ISO 8601-like format (before
'ISO 8601' was actually invented!), and all dates and times in the UT (or UTC,
or GMT ~equivalents) time-scale for all 'modern' data, calculations and
observations; and to use JD for all 'ancient' calculations.


1997-02-08\Date Standards.
                          
                          
                          
   
This document is CopyRight Ian Galpin, 19 Palmer Road, Poole, Dorset, England,
BH15 3AR. Permission is given for distribution via Internet and via magnetic
media only. No fee may be charged for this distribution and the document shall
be passed on in full, no alterations are permitted. For permission to reprint
or use in a business environment, write to the author at the address above.
Comments and suggestions on any Y2K or related topic are also always welcomed.
                          
                          
                          
   
Key Words for Internet Search-Engines: Year2000 Year 2000 Y2K Millennium VHF
Computer Problem Crash Astronomy Date Time Day Julian Gregorian Calendar UHF
ISO Standard ISO8601 ISO 8601 BSEN28601 BS EN 28601 Format Month UTC GMT SHF
JD UT International Program Programming Data Amateur Ham Radio Contest IARU