XML Date and Time Structure

07 Dec 2001 13:18

excerpted from ISO8601:1988

The format is specifically stated as follows:

YYYY-MM-DDThh:mm:ssTZD
where:
YYYY
= a year designation of four (4) numeric digits based on the Gregorian Calendar. All four digits are required.
-
= the field separator
MM
= a month designation of two (2) numeric digits with a leading zero being significant. "00" through "12" is the acceptable range.
-
= the field separator
DD
= the day of the month in numeric format with a leading zero being significant. "00" through "31" is the acceptable range.
T
= a separator indicating the start of the time field.  The spec states that the T may be omitted if "there is no risk of confusing a combined date and time."   Whether the T can be replaced with a space is not specified.
hh
= a two numeric digit hour descriptor based on the 24 hour clock (i.e. 2:00 p.m. would be 14:00 hours). "00" through "24" is the acceptable range.
:
= the field separator for the time record
mm
= a two numeric digit minute descriptor with a leading zero being significant. "00" through "59" is the acceptable range.
:
= the field separator for the time record
ss
= a two numeric digit second descriptor with a leading zero as significant. The seconds field cannot be omitted in this structure. "00" through "59" is the acceptable range.  Fractional seconds may be represented by placing a dot (.) or comma (,) after the seconds.  For example, "35,5" is 35 and one-half seconds.
TZD
= the optional Time Zone Descriptor. This is usually expressed in terms of offset from Coordinated Universal Time (the old Grenwich Mean Time) and is expressed in plus or minus hours and minutes and must follow the same precepts as noted above.
<ins datetime="1997-08-15T11:12:00-0400">

ISO8601 also describes how to represent time periods, such as "December 1999 to June 2000"