Showing posts with label MySql TIMESTAMP. Show all posts
Showing posts with label MySql TIMESTAMP. Show all posts

Friday, August 1, 2008

How to get the date from MySql TIMESTAMP column using php

In mysql you can use a TIMESTAMP type to store both date and time in a table column in this format YYYY-MM-DD HH:MM:SS
Sometimes you need to get only the date part from the TIMESTAMP.
You can use mysql date() function to do this


<?php

$today = date("Y-m-d"); //todays date

$query = "select * from tbl where DATE(c_timstp) = $today";

$result = mysql_query($query);

?>



Get Free Sinhala IT Learning Videos Kuppiya.com


Get custom programming done at GetAFreelancer.com!