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 7 of 7
  1. #1
    Regular Coder
    Join Date
    Sep 2004
    Posts
    713
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Field type problem

    i set field"start date" as DATE

    but when i enter date formate like 2006-10-28
    YYYY-MM-DD format
    the data cannot be entereed

    0000-00-00 is recorded
    what happens
    flying dagger

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    are you talking about MySQL? Wrong Forum?

    maybe we can see some code? maybe the query? maybe a description of that table?
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #3
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    -----------------
    Last edited by raf; 02-08-2006 at 10:01 AM. Reason: please remove --> double posted after errormessage
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #4
    Regular Coder
    Join Date
    Sep 2004
    Posts
    713
    Thanks
    6
    Thanked 2 Times in 2 Posts
    HI,
    my database
    Code:
    CREATE TABLE mw_test(
    id INT(15) AUTO_INCREMENT NOT NULL,
    todaydate DATE,
    PRIMARY KEY(id)
    )
    Then i do one mysql insert
    Code:
    $sql=$db->query("INSERT INTO mw_test VALUES(NULL,'2006-10-22')");
    then you check the phpmyadmin you will discover that the inserted todaydate is 0000-00-00
    very strange
    flying dagger

  • #5
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try changing your query to

    sql=$db->query("INSERT INTO mw_test (todaydate) VALUES('2006-10-22')");

    or run this inside the phpMyAdmin querywindow:
    INSERT INTO mw_test (todaydate) VALUES('2006-10-22')
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #6
    Regular Coder
    Join Date
    Sep 2004
    Posts
    713
    Thanks
    6
    Thanked 2 Times in 2 Posts
    can i enter value like DD-MM-YYYY
    flying dagger

  • #7
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you can try, and MySQL will try to interpret it, but there is no guarantee that this interpretation will be correct. For instance, should 01-02-2005 be the first of februari or the second januari?
    MySQL doesn't realy have a way of telling that, so it's not a good idea.

    Did you try the suggestions i posted + what was the result?
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html


  •  

    Posting Permissions

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