brendan-amex
asked on
MySQL Date Input
I'm building a PHP database front end with a MySQL backend and it's great, MySQL is perfect. Well almost. The way you enter dates here is not intuitive. I want to create some kind of mask that will allow me to enter a date as MM-DD-YYYY or MM/DD/YYYY and then have it resolve to YYYY-MM-DD. Any help is appreciated.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
fishboy - thank you. that's a great option. I have it on my site but I want to be able to remove the drop down for format options and have the default be the second option yy-mm-dd to match MySQL, do you know how I can change the default so I can remove the dropdown? If I remove the dropdown now, it reverts back to the mm/dd/yy default.
ASKER
Ignore that. I figured it out. Thank you! A+
You are welcome
http://www.w3schools.com/php/php_ref_date.asp
http://www.w3schools.com/php/func_date_strtotime.asp
Then you can use date() to format the date however you want.
http://www.w3schools.com/php/func_date_date.asp