我正在使用 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/