Zoha Ali Khan
Zoha Ali Khan

Reputation: 1699

Date to Timestamp Help required

I am using jQuery DatePicker to select from date and to date. 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.

when I convert the selected date from date picker using 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?

Upvotes: 1

Views: 140

Answers (1)

Eugen Rieck
Eugen Rieck

Reputation: 65332

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

Upvotes: 5

Related Questions