note 55796 deleted from function.date by victor

From: Date: Sun, 14 Aug 2005 09:39:08 +0000
Subject: note 55796 deleted from function.date by victor
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-93579@lists.php.net to get a copy of this message
Note Submitter: InterNic Reason: useless ---- If you need to convert the "short textual representation of a month, three letters" to "Numeric representation of a month, with leading zeros" for some reason, here is a simple function to do that: <? function monthNumber($month) { $months = array(1 => 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); for ($i = 1; $i < 13; $i++) { if ($month == $months[$i]) { if ($i < 10) $num = "0" . $i; else $num = $i; } } if (!$num) return false; return $num; } echo monthNumber("Jan"); ?>

« previous php.notes (#93579) next »