Tony The Lion
Tony The Lion

Reputation: 63190

boost::posix_time::ptime to UTC8601?

Is there a way to convert an object of type boost::posix_time::ptime to format UTC8601?

Upvotes: 3

Views: 1435

Answers (2)

StevieG
StevieG

Reputation: 8709

Depends what you mean by convert.. If you just want to see the ISO string, use

std::string to_iso_string(ptime)

or

std::string to_iso_extended_string(ptime)

or to pull out the date and time components as date and time_durations use:

date d(ptime.date())

and

time_duration td(ptime.time_of_day())

Upvotes: 2

Raphael Bossek
Raphael Bossek

Reputation: 1954

Take a look at boost.date_time library especially for the set_iso_format() and set_iso_extended_format() methods referenced by new date_time IO streaming system.

Upvotes: 3

Related Questions