2016-10-17 21 views
1
$one = '2016-10-11'; 
$two = '2016-10-13'; 
$three = '2016-10-15'; 
$four = '2016-10-16'; 
$five = '2016-10-17'; 

$output_format = 'Y-m-d H:i:s'; 

var_dump(
    strtotime($one), 
    strtotime($two), 
    strtotime($three), 
    strtotime($four), 
    strtotime($five), 
    date($output_format, strtotime($one)), 
    date($output_format, strtotime($two)), 
    date($output_format, strtotime($three)), 
    date($output_format, strtotime($four)), 
    date($output_format, strtotime($five)) 
); 

これは '2016年10月16日午前1時00分○○秒' は一時00分00秒を持っており、他の人が午後12時00分00秒を持っているのはなぜ?奇妙な行動

int 1476154800 

int 1476327600 

int 1476500400 

int 1476586800 

int 1476669600 

string '2016-10-11 00:00:00' (length=19) 

string '2016-10-13 00:00:00' (length=19) 

string '2016-10-15 00:00:00' (length=19) 

string '2016-10-16 01:00:00' (length=19) 

string '2016-10-17 00:00:00' (length=19) 

を出力 私はPHP 5.5.29を使用しています。

+0

私はそれを実行し、出力予想ました: 'int型(1476158400)がINT(1476331200)int型(1476504000) int(1476590400)int(1476676800)string(19) "2016-10-11 00:00:00" string(19) "2016-10-13 00:00:00" string(19) "2016-10-15 00:00:00 "string(19)" 2016-10-16 00:00:00 "string(19)" 2016-10-17 00:00:00 "' – Chizzle

+0

PHPバージョン5.6.18 – Chizzle

+0

http://sandbox.onlinephpfunctions.com/code/b3dbbac7c8bf43ee4e8d05f0132feaf0d7629464私はそれぞれの日付のために '00:00:00'しか得ていません。 –

答えて

1

「夏時間」(DST)に関連することが判明しました。それは1時00分00秒を持っている理由ですので、私のphp.iniのタイムゾーンは現在、ここブラジルで

date.timezone = America/Sao_Paulo 

に設定されている私たちは、2016年10月16日で「夏時間」(DST)が入りました。面白いことに、それが何年もの間私に起こったのは初めてです。