<datetime> generally indicates a date and time after the conventions of the International Organization for Standardization (ISO), ISO 8601 (see also for example http://en.wikipedia.org/wiki/ISO_8601, and http://de.wikipedia.org/wiki/ISO_8601). The indication consists of a four-digit year number, a two-digit month number (with leading zero, if necessary), and a two-digit day number (with leading zero, if necessary). Year, month, and day numbers may be separated by a hyphen "-" for better human readability. The date can be succeeded — separated by the upper letter "T" (for "Time") or simply by a space " " — by a time designation. Hours, minutes, and seconds respectively, are given as a two-digit number (with leading zero, if necessary). Again, for a better human readability, hours, minutes, and seconds may be separated by a colon ":". Finally, the time designation may be followed by the upper letter "Z" (for "Zulu Time") to indicate coordinated universal time (UTC), or — indicating this more precisely — by an "+" or "-" followed by a two-digit hour number, and a two-digit minutes number, if necessary (optionally separated by a colon for better human readability).
Not in every case the complete date and time is known. In these cases it is possible to omit lower order time/date elements. If only time is given, it must be preceded by a "T".
Examples:
February, 1985 -> 1985-02 or 198502
January 5th, 1997 -> 1997-01-05 or 19970105
October 25th, 2008, 16:05 hour UTC -> 2008-10-25T16:05 or 2008-10-25T16:05Z or 2008-10-25T16:05+00:00 or 2008-10-25 16:05 or 20081025T1605 or 20081025T1605+0000
9:47 hour -> T09:47 or T0947 (the "T" must be given in this case — otherwise without "T" in the format T0947 it would indicate the year 947)
<datetime> also allows to indicate a duration. For this purpose, an uppercase letter "P" (for "period") prefixes the expression. The format then is PnYnMnDTnHnMnS, where "n" indicates the value for each of the date and time elements that follow the "n". "Y" designates the year, "M" the month, "D" the day, "T" indicates the beginning of the time representation, "H" the hour, "M" the minute, and "S" the second. Also, the number of weeks may be given in the format PnW. Leading zeros are not required here. Date and time elements including their designator may be omitted if their value is zero, and lower order elements may also be omitted for reduced precision. The smallest value used may also have a decimal fraction.
Examples:
3 years, 8 months, 20 days, 7 hours, 45 minutes, 18 seconds -> P3Y8M20DT7H45M18S
9 years -> P9Y
3 months -> P3M, but 3 minutes -> PT3M
half a year -> P6M or also P0.5Y
36 hours -> PT36H or P1DT12H, both are possible
A duration can be given in three different formats. As start and end date, as start date and a duration, or as duration with end date. In every case a slash "/" is used as separator. Considering May 1st, 2000 as start date, and July 1st, 2000 as end date (duration two months ;-) ) the following possibilities do exist:
indication as start and end date -> 2000-05-01/2000-07-01
indication as start date with duration -> 2000-05-01/P2M
indication as duration with end date -> P2M/2000-07-01
<datetime> is compulsory in that cases, if it is the only child element of its parent element: <dateofflight>, <dateoftrip>, <issuedate>, <sunk>, and <validdate>. Additionally, it must be given within <divecomputerdump> (though there is a second element <dcdump> — which also is compulsory). In all other parent elements <datetime> can be given, but is not mandatory.
<dateofflight>, <dateoftrip>, <dive>, <divecomputerdump>, <examination>, <generator>, <imagedata>, <issuedate>, <purchase>, <sunk>, <validdate>
(see also <examination>, or <imagedata> e.g.)
<repetitiongroup> <dive> ... <!-- Date April 6th, 1999 (Tuesday), 10:24 hours --> <datetime>1999-04-06T10:24</datetime> <!-- here more statements --> ... </dive> <!-- here can follow more dives --> ... </repetitiongroup>