Boost :: posix_time :: ptime to UTC8601?

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

+3
source share
2 answers

Depends on what you mean by conversion. 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 pull out the date and time components as the date and time:

date d(ptime.date())

and

time_duration td(ptime.time_of_day())
+2
source

Take a look at boost.date_time , especially for the methods set_iso_format()and the set_iso_extended_format()new date_time IO streaming refers to .

+3
source

Source: https://habr.com/ru/post/1783601/


All Articles