Add 30 seconds to the time with PHP

后端 未结 8 2041
旧时难觅i
旧时难觅i 2021-02-05 03:29

How can I add 30 seconds to this time?

$time = date(\"m/d/Y h:i:s a\", time());

I wasn\'t sure how to do it because it is showing lots of diffe

相关标签:
8条回答
  • 2021-02-05 04:11

    General :

    $add_time=strtotime($old_date)+30;
    $add_date= date('m/d/Y h:i:s a',$add_time);
    
    0 讨论(0)
  • 2021-02-05 04:12

    See mktime:

    mktime (date("H"), date("i"), date("s") + 30)
    

    http://www.php.net/manual/en/function.mktime.php

    should do what you want.

    0 讨论(0)
提交回复
热议问题