Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Posts
    24

    Red face Unanswered: Default date values in MySQL

    How can I make a field automatically use today's date in YYYY-MM-DD format (Date datetype)? I tried a few different ways, but nothing worked. I have even searched the MySQL manual online... Please help!

    Thanks in advance.

  2. #2
    Join Date
    Jul 2004
    Location
    Dundee, Scotland
    Posts
    107
    MySQL itself does not provide functionality so that a date field will default to "today's date" (in the MySQL table definition). You can for example insert today's date using a MYSQL function in the INSERT SQL. See CURDATE(), CURTIME(), NOW().

  3. #3
    Join Date
    Sep 2003
    Posts
    24
    OK - I will have to use a 'hidden' field in my form to handle the default value of the 'date_created' field. (I am using this DB as a backend for an Access frontend.) Thanks for your help!

Posting Permissions

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