有人可以解释一下吗?仅当时间为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
谢谢!
答案 0 :(得分:3)
2013年3月10日美国开始夏令时,当时钟向前移动到凌晨3点。您的时区是PDT - 即太平洋夏令时时间,仅在当天凌晨3点有效。早于此时区是PST - 太平洋标准时间,凌晨2点结束。