Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2007-04-21 14:11:16

Chris Webster wrote:
> Neither of the functions I listed in the title seem to support a time of
> the format: 1999-12-17T15:15:15 (that is delimited with dashes and
> colons *and* with the 'T' in it). From everything I've seen (wikipedia,
>, that is a valid ISO time stamp.

Hi Chris -

Sorry for the slow reply. Indeed, from_iso_string only handles non-delimited
iso format. That is:

   std::string s("19991217T151515");
   ptime t = from_iso_string(s);

Couple possibilities. 1) strip the '-' and ':' chars before you call
from_iso_string. 2) Use the streaming operators with iso extended mode:

   std::stringstream ss;
   time_input_facet* input_facet = new time_input_facet();
   ss.imbue(std::locale(ss.getloc(), input_facet));
   ptime t1;
   ss >> t1;


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