gpt4 book ai didi

php - 需要时间戳帮助的日期

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

我正在使用 jQuery DatePicker 来选择开始日期和结束日期。当我选择一个日期时,我使用 strtotime 函数将其转换为时间戳,我的数据库中存储了一些日期,列类型为时间戳。

当我使用 strtotime 从日期选择器转换所选日期时

 $from_date = strtotime($form['from-date']);

它给了我这样的东西

   1338508800

虽然存储在我的数据库表中的日期看起来像这样

2012-06-09 02:24:25     

我想根据选择的日期查询记录。但查询没有正确获取我的日期。

如何更改所选日期,以便在两个所选日期之间给出结果?

最佳答案

你想要date('Y-m-d H:i:s',strtotime($form['from-date']));

关于php - 需要时间戳帮助的日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10973297/

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