ISO 8601 is the 'official' way to represent dates, weeks, months, and time intervals. For each, there is a "human-readable" version and a "compact" version.

General rules:

Dates

These will go in human-readable, then compact-form order.

Time

Times get into the realm of time zones & UTC. Time strings are prefixed with the literal character "T" and postfixed with some sort of time zone indicator. In all cases, you can leave off more granular details if they don't apply.

Full Timestamps

Full timestamps take any valid full date, slap on a "T", then include any valid time format. There's a litany of permutations. Here are some examples.

Durations & Intervals

Durations are prefixed with a "P" (indicating "period"). They can be marked by a combination of an integer number of Years, Months, Weeks, Days, Hours, Minutes, and Seconds (Y,M,W,D,H,M,S, respectively). For symmetry (& to diambiguate "months" and "minutes") with the Date & Time representation, there is a T separating the "years/months/days" part from the "hours/minutes/seconds" part.

Examples: