Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2003-09-08 08:48:28

Obviously I picked a bad time to be away :-)

I'll try to summarize and respond...

Fred wrote:
> There are a large number of date standards out there. The only
> international one that I'm aware of is ISO 8601. (There might be
> more. I'm not a date expert.) ISO 8601 has several advantages over most
> national "standards".

Victor wrote:
>the date was held as 14 digits in YYMMDDHHmmsshh and generally formatted
>as YY/MM/DD HH:mm:ss.hh Nobody, and I mean _nobody_ ever questioned
>what that meant.

Fred is correct in that ISO 8601-2000 is the main standard on formatting of
dates and times. And obviously Victor was thinking ahead as the basic format
is very similar to that specified in 8601. There are two formats for times:

Basic format: YYYYMMDDTHHmmss
Extended format: YYYY-MM-DDTHH:mm:ss

Note that a 'T' is used as the separator between date and time. For
fractional seconds you can use either a ',' or '.' as the separator
where followed by an arbitrarily long set of

Basic format: YYYYMMDDTHHmmss,fff


Basic format: YYYYMMDDTHHmmss.ffffff
Extended format: YYYY-MM-DDTHH:mm:ss.ffffff

I had this in mind when I wrote the constructors for things like date which go
in the same order as the ISO date and time representations.

And of course you can do:
  ptime t1(from_iso_string("20030908T010203"));

which I find very difficult to read. To me the basic form is to make life
easier for computers will the extended from is much more readable for humans.
  Even so, the 'T' separator is not natural and is distracting. And hence the
customery space between date and time seems just right:

  ptime t1(time_from_string("2003-09-08 01:02:03.54321"));

As for the Expression Template representations I have been pondering how this
should be added. While it is indeed cool to be able to write:

  date d = 1/Jan/1970;

it is at odds with the other orderings of dates in the library. So perhaps it
should be limited to

  date d = 1970/Jan/1;

for consistency with ISO 8601 and the rest of the library?


Boost list run by bdawes at, gregod at, cpdaniel at, john at