gpt4 book ai didi

PHP - Strtotime - 添加时间

转载 作者:可可西里 更新时间:2023-10-31 22:54:16 25 4
gpt4 key购买 nike

我有这个变量:

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

我只是想加上三个小时并回显出来。

我已经看到了可以理解单词的 60 * 60 * 3 方法或硬编码“+ 3 小时”的方法。

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

最佳答案

最好的方法是您认为更具可读性的方法。以下表达式是相同的:

time() + 3 * 60 * 60

strtotime('+3 hours')

关于PHP - Strtotime - 添加时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11076334/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com