note 78881 deleted from function.preg-match by felipe

From: Date: Sun, 16 Dec 2007 11:12:33 +0000
Subject: note 78881 deleted from function.preg-match by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-133648@lists.php.net to get a copy of this message
Note Submitter: lorenzo dot campanis at gmail dot com ---- Here's a little function to manipulate the default MySQL datetime. //return date, time, timestamp from a MYSQL datetime YYYY-MM-DD hh:mm:ss function getMySQL_datetime($datetime) { if(preg_match("/(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\d{2}):(\d{2})/", $datetime, $dt)) { $d["year"] = $dt[1]; $d["month"] = $dt[2]; $d["day"] = $dt[3]; $d["hour"] = $dt[4]; $d["min"] = $dt[5]; $d["sec"] = $dt[6]; $d["timestamp"] = mktime($d["hour"], $d["min"], $d["sec"], $d["month"], $d["day"], $d["year"]); return $d; } else echo "Match Not Found!"; }

« previous php.notes (#133648) next »