MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Dan Buettner Date:June 26 2006 7:02pm
Subject:Re: Defaulting Date Field
View as plain text  
Jesse, a TIMESTAMP column in your table can be set to have the 'now' 
value when a row is inserted, or updated, or both.

http://dev.mysql.com/doc/refman/5.0/en/timestamp-4-1.html

Note the warning about TIMESTAMP behavior differing significantly prior 
to 4.1.

Dan


Jesse wrote:
> What is the best way to default a date/time field to the current 
> date/time? I've tried using Now(), but I get an error of course.  The 
> only other way I know of to do this is to add a trigger, which I can do, 
> but I find them bothersome, because they don't tend to backup and 
> restore properly.  Is there another way to do this?
> 
> Thanks,
> Jesse
> 

-- 
Dan Buettner
Thread
Defaulting Date FieldJesse26 Jun
  • Re: Defaulting Date FieldDan Buettner26 Jun