Boost logo

Boost Users :

From: Bart (bartmann.nsd_at_[hidden])
Date: 2005-07-20 09:08:05

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),

    << ldt.local_time() << '\n'
    << ldt.utc_time() << std::endl;

Output is:
  2005-Jul-20 12:00:00
  2005-Jul-20 16:00:00

Bart Garst

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at