Boost logo

Boost :

Subject: [boost] [date_time] Constructing ptime object from ISO 8601 compliant strings
From: Rush Manbert (rush_at_[hidden])
Date: 2010-07-30 21:29:34


A variation on this question was asked by Allen Cronce back in May, but I didn't see any answer posted.

The Posix Time description begins: "Defines a non-adjusted time system..."

I assume that this means it is not adjusted for time zone?

I need to construct ptimes from ISO 8601 compliant strings that may contain time zone information, such as this:
"2010-08-17 12:34:56-07:00"

If I constructed a ptime using this string, then used to_iso_string() to convert it to a string, I would expect to see "2010-08-17T19:34:56", but I don't. Rather, what I see is "2010-08-17T12:34:56" because the time zone portion of the string was ignored.

Does anyone have a suggestion for dealing with this situation? I have some ideas, but would be interested to hear what others have done.

Thanks,
Rush



Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk