OpenOffice.org Macros Explained

The International Standard ISO 8601 specifies the numeric representations of date and time. This standard notation helps to avoid confusion in international communication caused by numerous different notations, and increases the portability of computer user interfaces. In addition, these formats have several important advantages for computer usage compared to other traditional date and time notations.

The international standard date notation is YYYY-MM-DD, which is a four-digit year followed by a two-digit month and a two-digit day. The year is based on the usual Gregorian calendar. For example, March 8, 2003 is written as 2003-03-08. The separators are optional, so you could also express the date as 20030308; this is the format returned by CDateToISO. See Listing 8 . Other components of the date format are beyond the scope of this book. The ISO format has several advantages:

Listing 8: Convert to and from ISO date format.

Print CDateToISO("12/30/1899") '18991230 Print CDateToISO("12/30/1899 06:00:00") '18991231 Print CDateToISO(Now) '20030816 Print CDateFromISO("14320313") '03/14/1432 Print CDateFromISO("20030313") '03/13/2003 Print CDateFromISO("18991230") '00:00:00 Same 12/30/1899 bug

 

The function CDateFromISO generates a run-time error if the date contains a time component. There are also the standard difficulties with dates around December 30, 1899, in that they aren't distinguishable from a time. The behavior of the function CDateToISO is the same as the function DateValue: If the date is before 12/31/1899 and it contains a time component, the day is off by one.

Bug  

CDateToISO returns an incorrect day for dates prior to 12/31/1899 if they contain a time component.

Категории