'Boost convert string to time with zone offset (%q in time facet)
So I am recently trying to convert some time strings to ptime/local_date_time so I can convert them from whatever zone to utc. The format in question is "%a, %d %b %Y %H:%M:%S %q"
I am using the following to convert:
boost::local_time::local_time_input_facet* timeFacet = new boost::local_time::local_time_input_facet("%a, %d %b %Y %H:%M:%S %q");
std::stringstream ss;
ss.str(timeStr);
ss.imbue(std::locale(ss.getloc(), timeFacet));
boost::local_time::local_date_time localDateTime(boost::date_time::not_a_date_time);
ss >> localDateTime;
However, this ignorres the timezone, the localDatetime will just state its already in the UTC timezone, when for example I am passing: Wed, 13 Apr 2022 17:50:32 -0500
This is not quit right, I did try %ZP but it does not work for time offset, how can I get around this to be able to get the time zone set in the local_date_time?
Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
