Poco::DateTimeFormatter Tips
时间:2011-04-08 来源:海天一鸥
DateTimeFormatter::format bug?
by 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?
by 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.