Ben Bennett <[EMAIL PROTECTED]> wrote: > Ok. So ISO8601:2000 defines all sorts of things, some of which > are impossible to distinguish from one another without outside > information: > > +yYYYYMMDD Extended complete year > +yYYYYDDD Extended ordinal day in year
No, these are called "expanded", not "extended" formats. The "extended" formats are something else. For instance, 2003-06-19 is an extended format, but 20030619 isn't. > -YYMM Year and month in implied century > -DDD Ordinal day in implied year > -YY Year in implied century > +yYYYY Extended year > +yYY Excended century Again, the formats you call "extended" formats are "expanded", not "extended" formats. > Notation: > -: - Character > Y,M,D: Year, month, day digit respectively > +: + or - characters > > The root of the collisions is the arbitrary number of extended > digits (which may be 0, so you could have -0101, now is that the > year 102 BC, or January in 2001? The extended formats also > collide internally, i.e. what is the date +1985? Is it a > century or a year? There is no collision. The standard clearly states that expanded formats should only be used when there is a mutual agreement by the partners using the formats. Implied: The agreement should contain the information necessary to disambiguate. If there is no agreement on what the format is, then you should assume that expanded formats are not used. And you still don't get the difference between "expanded" and "extended" formats. > The choices for resolving this are to: > 1) Never allow an extended representation (even for +s which > can't collide externally) unless the user tells us to use it and > specifies the digits > 2) Use the ordering above to break ties > > I am leaning towards choice 2 for this, but things are not > completely dire since I plan to allow the user of the module to > pick which categories of formats to allow (and to specify how > many digits are in an extended date). You shouldn't implement anything related to ISO 8601 until you have read and understood the standard. The standard clearly states that you should use 1) since expanded formats should not be used unless there is an agreement to use them. Peter -- Peter J. Acklam - [EMAIL PROTECTED] - http://home.online.no/~pjacklam