[PHP] date wierdness
On PHP3 where $row[art_date] == 2002-05-03, $thedate resolves to Thurs, May 2, 2002 YESTERDAYS DATE! See for yourself, if you wish, here: http://www.endvaw.org/current.php3 What gives. $row = mysql_fetch_array($result); $blah = eregi_replace(-, /, $row[art_date]); $thedate = date(D, M d, Y, strtotime($blah)); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date wierdness
On Fri, 3 May 2002, ROBERT MCPEAK wrote: On PHP3 where $row[art_date] == 2002-05-03, $thedate resolves to Thurs, May 2, 2002 YESTERDAYS DATE! See for yourself, if you wish, here: http://www.endvaw.org/current.php3 What gives. $row = mysql_fetch_array($result); $blah = eregi_replace(-, /, $row[art_date]); $thedate = date(D, M d, Y, strtotime($blah)); GMT? Add/subtract the appropriate number of hours for your time zone and see what happens. Or at least print out date(D, M d, Y H:i:s). miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date wierdness
Long ago I saw this same thing and never did resolve it since the easier solution is to let MySQL format the date for you using DATE_FORMAT. Formatting the date using PHP tools from data derived from a query will just drive you nuts. There is some kind of thing that MySQL and PHP don't agree on and I just have no idea what. Weirdness indeed. Avoid it and live long and prosper. John On Fri, 3 May 2002, ROBERT MCPEAK wrote: -On PHP3 where $row[art_date] == 2002-05-03, -$thedate resolves to Thurs, May 2, 2002 - -YESTERDAYS DATE! - -See for yourself, if you wish, here: -http://www.endvaw.org/current.php3 - -What gives. - -$row = mysql_fetch_array($result); -$blah = eregi_replace(-, /, $row[art_date]); -$thedate = date(D, M d, Y, strtotime($blah)); - --- -PHP General Mailing List (http://www.php.net/) -To unsubscribe, visit: http://www.php.net/unsub.php - ** John Huggins VANet [EMAIL PROTECTED] http://www.va.net/ ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php