Insert different dates into a database table.

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
mattyboi
Forum Commoner
Posts: 34
Joined: Mon Feb 06, 2006 9:42 pm

Insert different dates into a database table.

Post by mattyboi »

Hello,

I have a form with serveral different date fields. I would like to insert these into a table, along with other info, but in the proper MySQL date format.

My users will be inputing the dates in this format (mm/dd/yy). How would I format this to insert them into the table in the proper DATE fomat.

*NOTE each date field in the database had the DATE type.

Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

explode() it, reassemble them in proper order and add the correct leading time to the year.
mattyboi
Forum Commoner
Posts: 34
Joined: Mon Feb 06, 2006 9:42 pm

Post by mattyboi »

That worked great thanks.

Once I format the date correctly 0000-00-00, will it just insert correctly into the DATE type field?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

try it. :)
Post Reply