List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:September 15 1999 1:58am
Subject:Date field
View as plain text  
>>>>> "Urb" == Urb LeJeune <urb@stripped> writes:

Urb> 	I'm sure I'm going to kick myself when I see the answer to this
Urb> question but cannot find it in the documentation or figure it out.

Urb> 	How do I set the date field to the current date when inserting
Urb> a new row? I've used CURDATE() in a select but cannot seem to 
Urb> get it to work with insert. How tried variations on:

Urb>  my $Insert = qq/
Urb>     INSERT INTO Rooms     (RoomCode, CreationDate)
Urb>      VALUES ("$RoomCode", CURDATE())/;

Urb> Urb

Hi!

Both CURDATE() and NOW() should work.  Another option is to insert a
NULL in a column of type TIMESTAMP.

Could you please repost with the mysqlbug script a full example
(include error messages) of what doesn't work for you?

Regards,
Monty

Thread
QuestionSmirnov Andrey14 Sep
  • Re: QuestionPaul DuBois14 Sep
    • Date fieldUrb LeJeune15 Sep
      • Date fieldMichael Widenius15 Sep
  • Re: QuestionPaul DuBois14 Sep
    • Re: QuestionSmirnov Andrey14 Sep
      • Re: QuestionMichael Widenius17 Sep