[PHP-DB] Date weirdness (php/mysql) (code included) From: John Guynn (John.Guynn <email protected>)
Date: 11/08/00

I am storing dates in a MySQL database in the YYYY-MM-DD format.

$thisyear = "2000"; (sets current year)
echo $thisyear."<br>"; (debugging code)
$result = mysql_query("SELECT * FROM news WHERE YEAR(thedate) = '$thisyear'
ORDER BY thedate"); (select statement)
while ($row = mysql_fetch_array ($result)) {
echo "<br>".$row[thedate]."<br>"; (debugging again)
printf ("<h5 class=\"h5headl\">%s </h5>",date("F d, Y",$row[thedate]));
(prints EVERY date as December 31, 1969)
echo "<p class=\"story\">";
printf ("%s <a href=\"mar2000.php3\">%s's
Results</a>",$row[info],date("F",$row[thedate])); (prints EVERY month as
December)
echo "<br>";
}

What am I doing wrong? Is php's date() expecting a different format than
YYYY-MM-DD? The date range from 2000-03-26 to 2000-07-30. Nothing near
1969-12-31.

Ideas or suggestions appreciated.

John Guynn

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>