some simple questions on Date/Time parsing and formatting

The Boost function ptime from_iso_string seems to only take part of a ISO 8601 date string. In particular, strings coming from XML will have a trailing Z. Even knowing that we will always get 'Z' and not some arbitrary timezone information, it seems a kludge to truncate the last character from the string before feeding it to a function that claims to parse an ISO date/time string. Am I missing something? Second, is there a simple function to format a ptime using the conventions of the current Locale? I see functions for "simple" and "iso", but user-facing output (as opposed to creating an XML file) needs to use local conventions. Thanks, —John

On 03/19/2012 10:10 PM, John M. Dlugosz wrote:
The Boost function ptime from_iso_string seems to only take part of a ISO 8601 date string. In particular, strings coming from XML will have a trailing Z. Even knowing that we will always get 'Z' and not some arbitrary timezone information, it seems a kludge to truncate the last character from the string before feeding it to a function that claims to parse an ISO date/time string. Am I missing something?
Second, is there a simple function to format a ptime using the conventions of the current Locale? I see functions for "simple" and "iso", but user-facing output (as opposed to creating an XML file) needs to use local conventions.
See http://www.boost.org/doc/libs/1_49_0/doc/html/date_time/date_time_io.html#da.... It shows how to imbue streams with modified locales that can output the date_time values. -- VZ
participants (2)
-
John M. Dlugosz
-
Václav Zeman