I have the below codes which contain a date.
echo $giorno_selcted;
$post_date = date("Y-m-d", strtotime(stripslashes($giorno_selcted)));
$giorno_selected// echoes a date in this format 25-09-2012
$post_date// creates a date in format Y-m-d – 2012-09-25
What i need is to create two variables which will convert the $post_date to a timestamp i.e 2012-09-25 00:00:00 and 2012-09-25 23:59:59
$post_date_start = 2012-09-25 00:00:00
$post_date_finish = 2012-09-25 23:59:59
Thanks!
I have this query which permits me to print all the information inserted between two timestamps. But i get an error in the syntax which says,
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ’00:00:00 AND’ at line 1
Here is the code:
$post_date = date("Y-m-d", strtotime(stripslashes($giorno_selcted)));
$time_end = "23:59:59";
$time_start = "00:00:00";
$giorno_timestamp_start=$post_date.' '.$time_end;
$giorno_timestamp_start=$post_date.' '.$time_start;
$information="SELECT * FROM scheda_anagrafica WHERE time_inserted BETWEEN " . $giorno_timestamp_start. " AND ". $giorno_timestamp_end;
the time_inserted fieldis as a timestamp field..
Thanks
You can use a simple php