SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Mar 2005
    Posts
    421
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    default value for date field

    I have probably the simplest table imaginable:

    subscribtions (email, date_subscribed)

    where date_subscribed is a DATE field, i was wondering how i can set the default value to be todays date, like NOW() but without the time?

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,401
    Mentioned
    147 Post(s)
    Tagged
    4 Thread(s)

  3. #3
    SitePoint Evangelist
    Join Date
    Mar 2005
    Posts
    421
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that's what i thought originally, but when i run the following in mysql query browser i get an error:
    Code:
    ALTER TABLE `my`.`subscriptions` MODIFY COLUMN `date_subscribed` DATE DEFAULT CURDATE();
    "mysql error number 1064 - check you have the right syntax to use CURDATE" (or words to that effect)


Bookmarks

Posting Permissions

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