I am writing a small Time calculation. It should always add 3h to a given time.
But if i do "+3 h"
in the method strtotime()
in php it will output another value. So I wonder why "+3 hours"
will work. Can somebody explain me why?
My php version is: 7.0.33-0ubuntu0.16.04.4
$date = "2019-05-04 15:00"; //format is Y-m-d H:i
$out = date("Y-m-d H:i", strtotime("+3 h", strtotime($date)));
echo $out; //out = 2019-05-04 14:00
$date = "2019-05-04 15:00"; //format is Y-m-d H:i
$out = date("Y-m-d H:i", strtotime("+3 hours", strtotime($date)));
echo $out; //out = 2019-05-04 18:00
This is a test example code from me. And $date
is a different value every 15min.
PS: this is my first question on stackoverflow - Hello World :D