![]() |
1
4
基于UTC,epochtime只有一个标准定义,而不同时区没有不同的epochtime。 如果你想找到 offset between gmtime and localtime 使用
|
![]() |
2
6
|
![]() |
3
2
你只需要设定时区。尝试: env TZ=UTC+1 perl -e 'use Time::Local; print timelocal("00","00","00","01","01","2000"),"\n";' |
![]() |
4
2
$ perl -MTime::Local -le \ 'print scalar localtime timelocal "00","00","00","01","01","2000"' Tue Feb 1 00:00:00 2000
你想要
$ perl -MTime::Local' -le \ 'print scalar gmtime timelocal "00","00","00","01","01","2000"' Mon Jan 31 23:00:00 2000
你想换个方向吗?
$ perl -MTime::Local -le \ 'print scalar localtime timegm "00","00","00","01","01","2000"' Tue Feb 1 01:00:00 2000 |
![]() |
5
2
虽然时间::本地是一个合理的解决方案,但最好使用更现代的面向对象的datetime模块。下面是一个例子:
对于时区,可以使用datetime::timezone模块。
CPAN链接: |
![]() |
6
0
另一个基于 DateTime::Format::Strptime
|
![]() |
Manny · 如何比较Perl中的字符串? 2 年前 |
![]() |
BioRod · 我不能用Perl打印键和值 2 年前 |
![]() |
user17227456 · Perl CLI代码无法追加字符串行 2 年前 |
![]() |
LearnToBeBetter · 读取文件,搜索字符串,打印字符串 3 年前 |
![]() |
KJ7LNW · 一些波斯语文本的宽字符印刷,但其他文本则没有 3 年前 |
![]() |
con · 如何搜索大型数据结构并返回一系列给出特定值的键/数组? 3 年前 |
![]() |
Pranay Nanda · 使用regex解析许可证文件 7 年前 |