Poco::DateTimeFormatter Tips

简介:

DateTimeFormatter::format bug?

Postby sgsoft » 25 Oct 2010, 18:07

below code :

Code:  Select all
   int tzd=Poco::Timezone::tzd();
   cout<<tzd<<endl;
   Poco::Timestamp now;
        cout<<Poco::DateTimeFormatter::format(now,Poco::DateTimeFormat::SORTABLE_FORMAT)<<endl;   //test1
   cout<<Poco::DateTimeFormatter::format(now,Poco::DateTimeFormat::SORTABLE_FORMAT,tzd)<<endl;  //test2

the test1 is same to test2 ? maybe the tsz parameter has no effect. why?
sgsoft
Posts: 5
Joined: 03 Jul 2010, 12:26

Top


Re: DateTimeFormatter::format bug?

Postby guenter » 27 Oct 2010, 16:22

DateTimeFormatter does not do local time calculation. The optional tzd is only used when the respective format specifier (%z or %Z) is present. To format a proper local time, pass an instance of Poco::LocalDateTime to DateTimeFormatter.


本文转自海天一鸥博客园博客,原文链接:http://www.cnblogs.com/sgsoft/archive/2011/04/08/2009226.html,如需转载请自行联系原作者

相关文章
|
1月前
|
开发者
Flutter笔记:Widgets Easier组件库(11)- 使用提示吐丝(Tip Toasts)
Flutter笔记:Widgets Easier组件库(11)- 使用提示吐丝(Tip Toasts)
29 1
Sublime Text自定义代码片段Code Snippets
Sublime Text自定义代码片段Code Snippets
261 0
|
算法
Tips In C
C语言中的使用操作 宏定义时使用do while防止语句的分离, 但是不使用与需要有返回值的语句, 这个时候可以参考第二条 宏定义时使用({}), ()加上{}的方式, 在代码中填写逻辑算法, 最后的一条语句就是该宏定义的返回值; 在使用该宏定义时需要以";"结尾
801 0
|
程序员 C++
|
SQL 数据库 C++