note 20637 deleted from function.time by aidan
| From: | aidan@php.net | Date: | Sat, 08 Oct 2005 01:07:56 +0000 |
| Subject: | note 20637 deleted from function.time by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-96644@lists.php.net to get a copy of this message | ||
Note Submitter: martinez at czluchow[remove-this] dot eu dot org
----
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/