International Standard ISO 8601 specifies numeric representations of date and time. RWDateTime now supports this standard, allowing you to construct from any ISO 8601compliant string an RWDateTime object.
The application of the ISO standard will help to avoid confusion among international users and support your application's portability. Using the ISO standard will offer you the following benefits:
language independence
consistency with the common 24hour time notation system
easy comparison and sorting of combined dates and times
compatibility with many international notations, including the Chinese date notation, which already uses the sorting order of yearmonthday
a fourdigit year representation
The ISO 8601 format may be used with the Gregorian and the Julian systems, as well as many others.
The ISO 8601 offers numerous choices when formatting dates. The Essential Tools Module supports all calendar dates and formats, with the exception of expanded formats.
The complete and extended format date notation is:
YYYYMMDD
where YYYY is the year, MM is the month, and DD is the day.
Example: 20011224 or December 24, 2001. You may omit the hyphens (), as follows: 20011224 (basic format).
The 8601 standard also allows formatting dates based on the ordinal week or the ordinal day, rather than the month, as follows:
YYDDD, YYDDD
This is a twodigit year followed by yearday number.
Example: 67256 corresponds to 09/13/1967
YYYYDDD YYYYDDD: fourdigit year followed by year day number
Example: 1967256 corresponds to 09/13/1967
DDD year day number
YYYYWwwD YYYYWwwD: Fourdigit year followed by week number and week day number
YYYYWww YYYYWww: Fourdigit year number followed by week number
YYWwwD YYWwwD: Twodigit year, week number and week day number
YYWww YYWww: Twodigit year, week number
YWww YWww: Onedigit year, week number
WwwD WwwD: Week number and week day number in default year
Www: Week number; default year and week day number
WD: Week day number in default year and week number
Note that the week number is calculated with first week of the year which is 1. The first week of the year is the first week which contains a Thursday. Thus, the first week of the year 1994 is not the week containing the 1st of January but rather the week 03/0109/01/1994. Year 2004 is an example of a year that has 53 ISO8601 weeks since it contains both the week containing 1st of January and the week containing 31st of December.
The complete extended format for representing time is:
HH:MM:SS
where HH is the hour, MM is the minute, and SS is the second. The time string may carry a leading "T" as in:
THH:MM:SS
The leading T may appear even when the time string is not a part of a datetime string. For example:
16:59:59 (Hour 16, minutes 59, seconds 59) or
T16:59:59
Using the same basic format, you may omit the colons (:) as follows: 165959.
For truncated representations, you may omit the seconds and/or minutes.
Example:
23:59 for 23:59 and zero seconds
23 for the hour 23 with zero minutes and zero seconds
Unless otherwise specified, the ISO standard applies the local time zone. To apply another time zone, use its offset from UTC (GMT).
Specifying UTC time: To specify the UTC time zone, add a "Z" to the end of the time zone string (representing "zero meridian"). For example:
011224T23:59:59Z
Specifying other times: For time zone offsets east, or ahead of, UTC time, use the notation+/HH:MM where "HH" is the hour and "MM" is the minute. For time zone offsets west, or behind, UTC time, use the notation "HH:MM", "HHMM", or" HH".
Be careful when specifying times as offsets of UTC. Offsets are strictly the number of minutes and seconds offset from UTC. For this reason, a time zone may be represented as an offset from UTC in addition to the application of Daylight Saving Time (DST) rules.
You may also identify different time zones using RWZone. See Section 3.4, "Setting the Time Zone," below.
Represent a complete extended format as shown here:
YYYYMMDDThh:mm:ss
where T serves as a separator between date and time.
Example: 20011224T23:59:59 or December 24, 2001 at one minute before midnight. The separators may also be removed, as shown here: 20011224T235959
The ISO standard allows the omission of certain components of the date or time string by substituting a hyphen to implicitly represent the omitted element. In this case, RWDateTime obtains the implied component from calls to the system.
Table 6 describes the formats for calendar dates, where Y represents year, M represents month, and D represents day.
Format  Description 
YY  twodigit year 
YYMM  twodigit year, twodigit month 
YYMM  twodigit year, twodigit month 
MMDD  twodigit month, twodigit day 
MMDD  twodigit month, twodigit day 
MM  twodigit month 
DD  twodigit day 
Table 7 describes the formats for ordinal dates, where Y is year, Www is week number, and D is week day number.
Format  Description 
YWwwD YWwwD  Onedigit year followed by week number, and week day number. Example: 1W521 and 1W521 represent the first day of the 52nd week of the first year of the current decade in the current century. 
YWww YWww  Onedigit year followed by week number 
WwwD WwwD  Week number and week day number in default year. Example: W521 and W521 represent the first day of the 52nd week of the current year. 
Www  Week number, with default year and week day number 
WD  Week day number in default year and week number Example: 358 represents the 358th day of the current year. 
Examples of combined datetime formats:
1224T59:59 represents December 24th of the current year; and 59 minutes and 59 seconds into the current hour.
24T59 represents the 24th day of the current month in the current year; and 59 seconds into the current minute in the current hour.
When an RWDateTime is converted into a string in ISO 8601 format, the string will take on the YYYYMMDDThh:mm:ss form.
You may also omit the century digits without adding an additional hyphen to imply the current century.
Example: 011224 to define the year as 2001
In conclusion, this section lists all of the supported combinations of date and time formats discussed in the sections above.
The Essential Tools Module supports all combinations of these date formats:



































The Essential Tools Module supports all combinations of the time formats shown here. Note that all of these formats may include a leading T and/or a time zone indication:


















©2004 Copyright Quovadx, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Quovadx, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.