|
|
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
|
|
|
SScast · awk日志文件中的日期到历元,并打印其他列 10 年前 |
|
|
user470760 · 日期类转换时间戳错误 10 年前 |
|
|
user4358169 · 大纪元时间转换上的年份错误 11 年前 |