Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does MySQL 5 support default current date for DATETIME? 1

Status
Not open for further replies.

VBRookie

Programmer
May 29, 2001
331
US

I've been googling on this and haven't gotten a clear answer ... does anyone know the final word about it? I didn't find what I was looking for in the manual.

- VB Rookie
 
In MySQL 4.1 (I haven't installed v.5 yet), it doesn't seem to be possible for DATETIME columns, but it is possible for TIMESTAMP columns:
[tt]
datetimefield TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
[/tt]

A common use of timestamp columns is to automatically record the time of the latest update of the record, but this can be prevented by omitting the "ON UPDATE" clause from the field's definition.
 

Ok Thanks for the information ... this has been very helpful!

- VB Rookie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top