【发布时间】:2013-04-09 01:32:14
【问题描述】:
我正在使用下面的代码来获取当前日期时间(山地时间)
const boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
//In mountain time I get now = 2013-Apr-08 20:44:22
现在我使用下面的方法进行转换
ptime FeedConnector::MountaintToEasternConversion(ptime coloTime)
{
return boost::date_time::local_adjustor <ptime, -5, us_dst>::utc_to_local(coloTime);
}
//这个函数假设给我纽约的时间(东部标准时间),我得到了
2013-Apr-08 16:44:22
这个时间是错误的任何建议我哪里出错了?
【问题讨论】:
-
我也想知道答案。
标签: c++ boost boost-date-time