I have a datepicker on my site. When you select a date, it displays as dd/mm/yyyy
In order to search the date, the mysql db has to be similar to it
But it looks like yyyy-mm-dd H:i:s which I cant search for
Edit
I also wanted to search between two dates but was having difficulty since the two formats were different
My question was, how would I format my search function to find a similarity from the datepicker and the mysql datetime?
Here’s what I have so far (date_avialable is the column name)
$sql = mysql_query("SELECT * FROM search_v WHERE Currency='$currency' AND rout_to='$sto' AND
rout_from='$sfrom' AND DATE_FORMAT(date_avialable,'%Y-%m-%d') BETWEEN '$sfromda' AND 'stoda' LIMIT 10") or die(mysql_error()) ;
while ( $runrows = mysql_fetch_array($sql))
I wanted to do something like this
$mysqldate = date( 'Y-m-d H:i:s', $phpdate );
$phpdate = strtotime( $mysqldate );
But didn’t know how to call that into the db
If your specification in question are correct try (to change) this in your code..
or separate your PICKER date to strings shown bellow on the left and do this
If that aint gonna work, please go to phpmyadmin, and try to tell us what is the format of date in your “date_avialable” row. Is it a unix timestamp or d-m-Y or similar..