Boost logo

Boost Users :

Subject: Re: [Boost-users] date/time input facets - what am I doing wrong?
From: Boris Schaeling (boris_at_[hidden])
Date: 2009-06-13 12:34:56


On Fri, 12 Jun 2009 17:36:39 +0200, Joe Nardone <jnardone_at_[hidden]> wrote:

> I'm trying to get input facets working for dates and times using
> time_input_facet.
>
> (Boost 1.33.1 on RHEL5; upgrading is not an option at the moment)
>
> std::stringstream ss;
> ss.str("Feb 28 16:22:11 2009");
> time_input_facet* tf = new time_input_facet("%b %e %H:%M:%S %Y");
> ss.imbue(std::locale(std::locale::classic(), tf));
> ss.exceptions(std::ios_base::failbit);
>
> ptime z;
> ss >> z;
>
> std::cout<< z << std::endl;
>
> This throws an exception - Parse failed. No match found for ''

Replace %e with %d and try "%b %d %H:%M:%S %Y".

Boris


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