gpt4 book ai didi

php - 设置 Php 和 Mysql 时间戳

转载 作者:行者123 更新时间:2023-11-29 06:30:40 26 4
gpt4 key购买 nike

我需要设置时间戳,例如。分别提前4小时和提前2小时

在我的数据库中,我将他们的列作为时间戳。

我知道我可以做类似的事情,但不确定它是否正确。

// For 4 hours ahead of time

$dt2 = date("Y-m-d 04:i:s");


//For 2 days ahead

$dt2 = date("Y-m-02 H:i:s");

最佳答案

//For 4 hours ahead of time
$dt2 = date("Y-m-d H:i:s", strtotime('+4 hours'));

//For 2 days ahead of time
$dt2 = date("Y-m-d H:i:s", strtotime('+2 days'));

关于php - 设置 Php 和 Mysql 时间戳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28110361/

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