Insert date of birth in Database
I Have a form in my website.
i have got 3 different drop downs for Day, Month and Year.
i am trying to save them into a single field in the DB.
How can i do this,
Thank u so much for u r help
$date = $year."-".$month."-".$day;
hi thanks for your reply.
if i do like this ,date is is not diplaying correctly.
suppose if i submit 05-19-2002
i am getting result---> -5-
What is the field type you are saving to (date, datetime, varchar)?
i am saving it as date datatype
Can we see your form input fields and the code you were using that wasn't working?
datetime requirement of the date is in this format 'YYYY-MM-DD HH:MM:SS'
i.e. "2012-04-18 00:00:00" or similar.
You can still display the date in the format 04-18-2012 by using date_format (date, "%m-%e-%Y") in your sql query.
You can also enter it as 20120518 but not 05182012
Last edited by Dasher; 04-18-2012 at 07:20 PM.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)