Adding 1 hour to time variable

后端 未结 10 1271
南笙
南笙 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:48

    You can try this code:

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

提交回复
热议问题