PHP - Strtotime - 添加小时 [英] PHP - Strtotime - Add hours

查看:43
本文介绍了PHP - Strtotime - 添加小时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个变量:

$timestamp = strftime("%Y-%m-%d %h:%M:%S %a", time ());

我只是想增加三个小时并回显出来.

I simply want to add three hours and echo it out.

我已经看到了你可以做 60 * 60 * 3 方法的方式,或者它理解单词的硬编码+ 3 小时".

I have seen the way where you can do the 60 * 60 * 3 method or the hard code "+ 3 hours" where it understands the words.

获得此结果的最佳方法是什么?

What is the best way of getting this result?

推荐答案

$timestamp = strftime("%Y-%m-%d %h:%M:%S %a", time() + 3*60*60)

3*60*60 是最好的方法

这篇关于PHP - Strtotime - 添加小时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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