Code: Select all
2011-04-19 00:00:00I know how to add the date:
$today = (date('Y-m-d'));
But how do I use the same sort of simple format, to add the date and the time?
Moderator: General Moderators
Code: Select all
2011-04-19 00:00:00Code: Select all
$result = mysql_query ("SELECT DISTINCT dateviewed FROM recent") or die(mysql_error());
echo "<form method='post' action='index.php?page=test'>
<select name='datesub'>";
while ($row = mysql_fetch_object($result))
{
$date = substr($row->dateviewed, 0,10);
echo "<option value='$date'>$date</option>";
} mysql_free_result($result);
echo "</select><input type='submit' value='submit'></form>";Code: Select all
SELECT DATE('2011-04-20 12:00:00') # Returns '2011-04-20'