日期格式-如何在php中将"n"小时添加到当前时间? [英] Date Format - How to add 'n' hours to the current time in php?

查看:33
本文介绍了日期格式-如何在php中将"n"小时添加到当前时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到当前时间:

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

如何将当前时间增加5个小时?

How do I add 5 hours to the current time?

推荐答案

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

strtotime 将解析任何英文文本日期时间描述.

strtotime will parse any textual datetime description in English.

这篇关于日期格式-如何在php中将"n"小时添加到当前时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆