php string in a date format, add 12 hours

前端 未结 4 1447
无人共我
无人共我 2020-12-19 09:26

I have this string object in my php array

\"2013-03-05 00:00:00+00\"

I would like to add 12 hours to the entry within PHP, then save it back to

4条回答
  •  心在旅途
    2020-12-19 09:46

    Use this to add hours,

    $date1= "2014-07-03 11:00:00";
    $new_date= date("Y-m-d H:i:s", strtotime($date1 . " +3 hours"));
    echo $new_date;
    

提交回复
热议问题