dcsimg
www.webdeveloper.com
Results 1 to 7 of 7

Thread: Insert date of birth in Database

  1. #1
    Join Date
    Mar 2012
    Posts
    20

    Smile Insert date of birth in Database

    Hi
    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

  2. #2
    Join Date
    Jan 2006
    Location
    MN
    Posts
    440
    $date = $year."-".$month."-".$day;

  3. #3
    Join Date
    Mar 2012
    Posts
    20
    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-

  4. #4
    Join Date
    Jan 2009
    Posts
    3,346
    What is the field type you are saving to (date, datetime, varchar)?

  5. #5
    Join Date
    Mar 2012
    Posts
    20
    i am saving it as date datatype

  6. #6
    Join Date
    Jan 2009
    Posts
    3,346
    Can we see your form input fields and the code you were using that wasn't working?

  7. #7
    Join Date
    Jan 2006
    Location
    MN
    Posts
    440
    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 08:20 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles