Re: Date Conversion

From: Date: Tue, 16 May 2006 19:44:54 +0000
Subject: Re: Date Conversion
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-41914@lists.php.net to get a copy of this message
Mark Bomgardner wrote:
PHP 4.4/MySQL 4.0 I am tying to convert a date to put into a database from a string (ie: January, February) to a numeric value (ie: 01,02). I am taking the value from a form, which is a drop down menu listing the months. $sMonth1 = $_POST['Smonth']; returns the money selected from the form. When I go to format the month from a string to numeric with date('m',strtotime($sMonth1)); it returns 12, no matter which month I select. In reading the docs at php.net, date('m',strtotime($sMonth1)); is correct to reformat from a string to a time format. What am I missing. mark bomgardner An idea along a different path would be....
for your original select box where you pick the month do something like this: <option value="01">January</option> <option value="02">Febuary</option> .... Then the value passed to your form will be the numeric representation of the month so there will be no need to translate the String --> number.. HTH -Brad

« previous php.db (#41914) next »