Date Format - How to add 'n' hours to the current time in php? [duplicate]

江枫思渺然 提交于 2021-02-08 10:45:37

问题


I get current time:

$today = time();
$date = date('h:i:s A', strtotime($today));

How do I add 5 hours to the current time?


回答1:


$today = time();
date('h:i:s A', strtotime('+5 hours'), $today);

strtotime will parse any textual datetime description in English.



来源:https://stackoverflow.com/questions/31779306/date-format-how-to-add-n-hours-to-the-current-time-in-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!