Adding 1 hour to time variable

后端 未结 10 1259
南笙
南笙 2020-12-05 06:27

I have a time to which I want to add an hour:

$time = \'10:09\';

I\'ve tried:

$time = strtotime(\'+1 hour\');

strtotime(\'+1          


        
10条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-05 06:50

    You can use:

    $time = strtotime("10:09") + 3600;
    echo date('H:i', $time);
    

    Or date_add: http://www.php.net/manual/en/datetime.add.php

提交回复
热议问题