Boost logo

Boost Users :

From: Larry (lknain_at_[hidden])
Date: 2005-07-28 06:04:29

I searched the group and didn't see anything that answered my question
about date although I may have just not recognized it when I read it.

The date constructor will throw exceptions if you use an invalid date:

   date d(2005,2,29);

Throws an exception because there is no 29th of February in 2005.

If one does the following:

      string ds("20050229T000000");
      date d(from_iso_string(ds));

there is no exception and like localtime() and gmtime() it actually changes
the date silently to 20050301. (ptime also does this.)

Was this done intentionally perhaps to be consistent with localtime() etc
although that begs the question of why there was an exception in the first
case of date construction? Or perhaps I forgot to do something?

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at