3

I am saving date of birth in MySQLusing my form with

db->insert() 

method, but it's not properly inserted in the database. How can I save the input field value in the proper date format in MySQL? (In MySQL the type of dob is also set to "DATE".)

1
  • Kindly provide the code you are having trouble with. Commented Mar 21, 2013 at 5:12

2 Answers 2

2

MYSQL DATE - A date in YYYY-MM-DD format

so you need to convert via sql or php

PHP

$date= date('YYYY-MM-DD',strtotime($old_date));

$date= date('Y-m-d',strtotime($old_date));
Sign up to request clarification or add additional context in comments.

Comments

1

if you have taken your dateofbirth field's datatype as date then you have to insert date in yyyy-mm-dd format.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.