note 20637 added to function.time
| From: | martinez at czluchow dot chek dot com | Date: | Wed, 10 Apr 2002 23:33:09 +0000 |
| Subject: | note 20637 added to function.time | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-29087@lists.php.net to get a copy of this message | ||
Hi all.
I made a small modification to this function, so the MySQL TIMESTAMP string is converted to elements
of array, which are easily accessible.
Here is my example:
-----------------------------------
function convert_time($mysql_timestamp){
// YYYYMMDDHHMMSS
//this should be in one line, i think...
if (ereg("^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})
([0-9]{2})([0-9]{2})",$mysql_timestamp,$res)):
$year=$res[1];
$month=$res[2];
$day=$res[3];
$hour=$res[4];
$min=$res[5];
$sec=$res[6];
return(array($year,$month,$day,$hour,$min,$sec));
else:
return(false);
endif;
}
-----------------------------------
Enjoy :-)
Martinez
/I was made in Poland/
--
http://www.php.net/manual/en/function.time.php
http://master.php.net/manage/user-notes.php?action=edit+20637
http://master.php.net/manage/user-notes.php?action=delete+20637
http://master.php.net/manage/user-notes.php?action=reject+20637