Input format for SQL dates

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mjseaden
Forum Contributor
Posts: 458
Joined: Wed Mar 17, 2004 5:49 am

Input format for SQL dates

Post by mjseaden »

Dear All,

I have a PHP POST variable containing a date in DD/MM/YYYY format string. How do I record this to a DATE field in a MySQL table? Do I have to break up the string using explode() and somehow write the day month and year numbers separately?

Many thanks

Mark
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

http://dev.mysql.com/doc/mysql/en/DATETIME.html

Or you could convert it to the unix epoch time and store it as a int(10) field.
mjseaden
Forum Contributor
Posts: 458
Joined: Wed Mar 17, 2004 5:49 am

Post by mjseaden »

Thanks kettle.
Post Reply