0
我試圖讓使用strftime perl中的當前時間,但它不給我我想要的形式的時區。據此:http://search.cpan.org/~dexter/POSIX-strftime-GNU-0.02/lib/POSIX/strftime/GNU.pm,%z用於形式「-0700」,並且我看到%:z給出的形式爲「-07:00」,這是理想的。strftime時區給出的單詞形式,而不是偏移
但%z給我的時區名稱,%:z甚至不工作。
use POSIX qw/strftime/;
#This prints "2014-09-30T12:54:11-Pacific Daylight Time"
print strftime("%Y-%m-%dT%H:%M:%S-%z\n", localtime(time));
#This doesn't print anything
print strftime("%Y-%m-%dT%H:%M:%S-%:z\n", localtime(time));
#What I want: "2014-09-30T12:54:11-07:00"
在您的系統中,'man 3 strftime'對'%z'說什麼?或者說,它說你需要使用什麼?這是你正在使用的功能。 – ikegami 2014-09-30 20:02:31
你沒有使用'POSIX :: strftime :: GNU',那你爲什麼要引用它的文檔? – ikegami 2014-09-30 20:03:01