I found something odd about strtotime().
On dates that do not exist it returns the day after.
$d30= strtotime("2017-06-30");
Echo $d30 ."
";
Echo date("Y-m-d", $d30)."
"; // 2017-06-30
$d31= strtotime("2017-06-31");
Echo $d31 ."
";
Echo date("Y-m-d", $d31)."
"; // 2017-07-01
$d32= strtotime("2017-06-32");
Echo $d32 ."
";
Echo date("Y-m-d", $d32); // 1970-01-01
https://3v4l.org/AjMAE
I understand the last one. It returns nothing as it's an error.
But why does the second one return first of July?
Is it a meant to be functional, in case you make a mistake it will "correct you"? Or is it a true bug in strtotime()?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…