Need a better way...
| From: | Todd Cary | Date: | Sun, 27 Oct 2002 18:47:09 +0000 |
| Subject: | Need a better way... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-121607@lists.php.net to get a copy of this message | ||
My coding is not very concise and I would appreciate suggestions on how to clean this up even though it works:
/* MySQL to date */
function mysql_to_date($mysql) {
$retval = "";
if ($mysql) {
$parts = explode("-", $mysql);
$mo = $parts[1];
$dy = $parts[2];
$yr = $parts[0];
$parts = explode(" ", $dy);
$dy = $parts[0];
$retval = $mo . "/" . $dy . "/" . $yr;
} else {
$retval = "";} return $retval; } -- Ariste Software, Petaluma, CA 94952