
20 Jul
2005
20 Jul
'05
2:08 p.m.
On Tue, 19 Jul 2005 12:13:33 +0200, Charles BROSSOLLET wrote:
Hello,
I'm looking for a way to convert a local time to UTC time. I found c_local_adjustor::utc_to_local, but is there the reciprocal?
thanks,
The local_date_time class (available in current cvs) can do this. using namespace boost; using namespace local_time; time_zone_ptr east_us(new posix_time_zone("EST-05EDT,M4.1.0,M10.1.0")); local_date_time ldt(gregorian::date(2005, gregorian::Jul, 20), posix_time::hours(12), east_us ,true); std::cout << ldt.local_time() << '\n' << ldt.utc_time() << std::endl; Output is: 2005-Jul-20 12:00:00 2005-Jul-20 16:00:00 HTH, Bart Garst