RE: [PHP-DB] Converting Date Form Fields
| From: | Zach Curtis | Date: | Fri, 16 Nov 2001 17:02:05 +0000 |
| Subject: | RE: [PHP-DB] Converting Date Form Fields | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-14407@lists.php.net to get a copy of this message | ||
Ah, the join function...I see implode() will also perform the same task.
That was what I needed to do.
Thanks!
Zach
-----Original Message-----
From: matt stewart [mailto:matt@netvirtua.com]
Sent: Friday, November 16, 2001 9:06 AM
To: 'Zach Curtis'; php-db@lists.php.net
Subject: RE: [PHP-DB] Converting Date Form Fields
put them into an array
$date_stuff[0] = $date_year;
$date_stuff[1] = $date_month;
$date_stuff[2] = "01";
$date_to_enter = join('-',$date_stuff);
then whack $date_to_enter into your database - obviously if the input to
$date_month is "Jan", you need a case statement, or something like that to
make sure you change it to "01".
Hope it helps ;)
Matt
-----Original Message-----
From: Zach Curtis [mailto:zach@populus.com]
Sent: 16 November 2001 16:02
To: php-db@lists.php.net
Subject: [PHP-DB] Converting Date Form Fields
I have two HTML form fields birthMonth (e.g., Jan=1, Feb=2...) and birthYear
(e.g., 2001=2001, 1999=1999...). How can take these two individual form
fields, then add in a default value of "1" for the birthDay (this is not
asked in the form), and put this data into a MySQL table field birthDate
with field type DATE (YYYY-MM-DD)? The part I do not know how to accomplish
is taking these form fields and then combining them into a date
field/format.
Thank you.
Zach Curtis
POPULUS
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01