2013-10-19 172 views
0

有人可以解釋這一點嗎?它僅在時間爲1或2時才返回「無效日期」。在凌晨3點之後,它確實轉換爲unix時間戳。Linux日期:無效日期

[[email protected] ~]$ 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. 

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

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

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

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

謝謝!

回答

3

夏時制在2013年3月10日美國開始,當時鍾前進到凌晨3點。您的時區是PDT - 即太平洋夏令時時間,僅在當天凌晨3點有效。早於該時區是PST - 太平洋標準時間,凌晨2點結束。

+0

@rici我的部分錯字。應該是標準... – 2013-10-19 02:36:29