Glen McNamee
MYSQL to PHP and stuff.
Posted on Oct 28, 2002 in Websites

Hello, Another update just to keep my stock of Cack up,..

Remember yesterday (the entry before this one, dummy) where I spoke of converting the MYSQL datetime field into some PHP can display, well here is the code for those of you who interested.

$datetime=mysql_result($result,$i,1);

$yr = substr($datetime,0,4);
$mon = substr($datetime,5,2);
$day = substr($datetime,8,2);
$hr = substr($datetime,11,2);
$min = substr($datetime,14,2);
$sec = substr($datetime,17,2);

echo date (“d-M-Y H:i:s”, mktime ($hr,$min,$sec,$mon,$day,$yr));

The mysql_result($result,$i,1) is the date information I

Leave some feedback.

 
 
%d bloggers like this: