Boost logo

Boost Users :

Subject: Re: [Boost-users] date time format
From: Surya Kiran Gullapalli (suryakiran.gullapalli_at_[hidden])
Date: 2009-10-20 03:24:48


On Tue, Oct 20, 2009 at 9:49 AM, Sean Farrow
<sean.farrow_at_[hidden]>wrote:

> Hi:
>
> I’ve found this. There appears to be no format flags, that give me both a
> two digit month, i.e 22 and four digit year i.e 2009.
>
> Have I missed something.
>
> Sean.
>
>
>
you can do something like this.

boost::date_time::date d ;
std::istringstream is ;
is.imbue(std::locale (std::cout.getloc(), new
boost::date_time::date_input_facet ("%d %B %Y"))
is.str(*"22 July 2009"*);
is >> d ;

Format flags are documented at
http://www.boost.org/doc/libs/1_40_0/doc/html/date_time/date_time_io.html#date_time.format_flags

Surya



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