简体   繁体   English

日期时间戳需要帮助

[英]Date to Timestamp Help required

I am using jQuery DatePicker to select from date and to date. 我正在使用jQuery DatePicker从日期和日期中进行选择。 when I select a date i covert it to timestamp using strtotime function, I have some dates stored in my database with column type timestamp. 当我选择一个日期时,使用strtotime函数将其转换为时间戳记,我的数据库中存储了一些日期,列类型为timestamp。

when I convert the selected date from date picker using strtotime 当我使用strtotime从日期选择器转换所选日期时

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

it gives me something like this 它给我这样的东西

   1338508800

while the date stored in my database table looks like this 而存储在我的数据库表中的日期看起来像这样

2012-06-09 02:24:25     

I want to query the records on the basis of the selected from and to date. 我想根据所选的日期和日期查询记录。 but the query is not getting my dates correctly. 但查询无法正确获取我的日期。

How can I change the selected date so that it give me results in between the two selected dates? 如何更改选定的日期,以便在两个选定的日期之间给我结果?

您想要date('Ymd H:i:s',strtotime($form['from-date']));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM