Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: date

  1. #1
    New Coder
    Join Date
    Aug 2004
    Posts
    55
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question date

    hi,
    how would i be able to insert the date into my database if i have 3 dropdown boxes wherein it contain the month,day & year. i know the basic of inserting data into my database but with this 3 dropdown box i don't have any idea. after submitting, the data selected on these 3 boxes shall be in one field in my database with fieldname Date . any sample codes for this one?

    any help will be appreciated.

  • #2
    Regular Coder
    Join Date
    Apr 2004
    Posts
    684
    Thanks
    24
    Thanked 1 Time in 1 Post
    Join them together like this... depending on the method of date you're using you could use different seperators.

    PHP Code:
    $date $month '-' $day '-' $year
    Then simply just put $date into your database field.

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Record them as a timestamp into your database.

    Oops, wanted some code examples:
    Database format for column: INT 10 unsigned NOT NULL

    PHP Code:
    $date '14 October 2004';

    $date strtotime($date);

    // This will record as a time stamp into the database.  Extract with:

    $date date('F d Y'$yourquery['timestamp']); 
    Please note, you must follow GNU Date Syntax for this to correctly work.
    Last edited by Fou-Lu; 10-13-2004 at 12:01 PM.


  •  

    Posting Permissions

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