2012-10-05 39 views
7
const boost::posix_time::ptime now= boost::posix_time::second_clock::local_time(); 

year_ = now.date().year(); 
month_ = now.date().month(); 
day_ = now.date().day(); 

这是我如何得到boost :: posix_time :: ptime的年,月和日,但我无法弄清楚如何获得小时,分钟和秒。你能帮我解决吗?如何获得小时,分钟和秒

回答

13

答案是

now.time_of_day().hours(); 
now.time_of_day().minutes(); 
now.time_of_day().seconds(); 
+4

你能文档所以在添加一个链接到源我知道在哪里可以找到它的未来? –

1
Hours_=now.time_duration().hours; 
...