0

有人可以解释一下吗?仅当时间为 1 或 2 时,它才会返回“无效日期”。凌晨 3 点之后,它会转换为 unix 时间戳。

[user@localhost ~]$ date --version
date (GNU coreutils) 8.4
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.

[user@localhost ~]$ date --date="Sun Mar 10 01:59:00 PDT 2013" +%s
date: invalid date `Sun Mar 10 01:59:00 PDT 2013'

[user@localhost ~]$ date --date="Sun Mar 10 02:59:00 PDT 2013" +%s
date: invalid date `Sun Mar 10 02:59:00 PDT 2013'

[user@localhost ~]$ date --date="Sun Mar 10 03:59:00 PDT 2013" +%s
1362913140

[user@localhost ~]$ date --date="Sun Mar 10 04:59:00 PDT 2013" +%s
1362916740

谢谢!

4

1 回答 1

3

美国于 2013 年 3 月 10 日开始实行夏令时,时钟向前移动到凌晨 3 点。您的时区是 PDT - 即太平洋夏令时,仅从当天凌晨 3 点开始有效。在此之前,时区是 PST - 太平洋标准时间,于凌晨 2 点结束。

于 2013-10-19T01:10:44.803 回答