DP_DateExtension:
ISO 8601 Parsing/Formatting Examples
Back to the Main Page
All of these examples assume that the library has been imported as noted in the Documentation.
Parsing ISO 8601 Dates
To parse ISO 8601 dates invoke the parseIso8601() method directly from the date object. The following examples represent parsable versions of ISO 8601 dates:
- MyFormattedDate = Date.parseIso8601("2006");
- MyFormattedDate = Date.parseIso8601("2006-06");
- MyFormattedDate = Date.parseIso8601("2006-06-21");
- MyFormattedDate = Date.parseIso8601("2006-06-21T14:46");
- MyFormattedDate = Date.parseIso8601("2006-06-21T14:46:34");
- MyFormattedDate = Date.parseIso8601("2006-06-21T14:46:34.876");
- MyFormattedDate = Date.parseIso8601("2006-06-21T14:46:34Z");
- MyFormattedDate = Date.parseIso8601("2006-06-21T14:46:34-05:00");
Generating ISO 8601 Date/Times
Several examples of ISO 8601 formatting follow (these assume that "CurDate" is a valid JavaScript Date):