gpt4 book ai didi

php - 日期时间格式,更改格式。

转载 作者:行者123 更新时间:2023-11-29 09:14:25 25 4
gpt4 key购买 nike

我在页面数据库中有一个时间戳,因此采用这种格式$d="2011-01-03 12:53:22"

当我尝试通过 date("c",$d) 发送该信息时,我只得到 1970-01-01T10:33:31+10:00

我在 php 手册中读到 date("c",THIS) 必须是 INT 那么我用什么来从 "2011-01-03 12:53:22"获取 int ??

最佳答案

发送日期函数时忘记将日期字符串转换为时间戳

date('c', strtotime($d));

关于php - 日期时间格式,更改格式。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4581619/

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