|
Boost Users : |
From: Gregory J. Sharp (gregor_at_[hidden])
Date: 2007-02-27 11:29:06
On 27Feb2007, at 10:58 , Jeff Garland wrote:
> The main problem is that the time_from_string function is expecting
> a complete
> time (eg: 2006-12-26 00:00:00), not just a date. I believe all of
> these will
> parse correctly if you do this:
>
> using namespace boost::gregorian;
> date d = from_string("2006-12-06");
>
> which can trivially be turned into a ptime if that's what you need.
Thanks. I didn't see the requirement that it have a time component in
the manual. Perhaps it is worth adding a note about that?
The fact that it silently accepts "2006-12-06" but does the wrong
thing(TM) with it, is also a worry.
I will try to make a time_from_Gstring() function that parses more
aggressively, since I also prefer to avoid things like "2006-05-06
123" being a valid time, in my application.
-- Gregory J. Sharp email: gregor_at_[hidden] Wilson Synchrotron Laboratory url: http://www.lepp.cornell.edu/ ~gregor Cornell University ph: +1 607 255 4882 Ithaca, NY 14853 fax: +1 607 255 8062
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net