DateTimeFormatter::format bug?

Poco::DateTimeFormatter Tipsby 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?

Poco::DateTimeFormatter Tipsby 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.

相关文章:

  • 2022-01-22
  • 2021-09-27
  • 2022-12-23
  • 2021-06-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-08
猜你喜欢
  • 2021-10-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案