Currently I am using UNIX_TIMESTAMP() in my INSERTS, just the idea came to me that maybe I could use a MySQL function as a default for a field. Too bad MySQL doesn't allow it though......
Thanks for your reply though =) Oh and yeah, I knew the int(10) was for the display length ;p -- Keith Bussey Mana Internet Solutions, Inc. Chief Technology Manager +50 6 280 2284 ext.108 Quoting Michael Stassen <[EMAIL PROTECTED]>: > Sorry, my reply was incomplete, considering your question. You want > Unix timestamp format, and you want it to default to the current time. > Unfortunately, you can't do both. You can use a TIMESTAMP column, which > will default to NOW (the default you want), or you can use an INT column > and assign UNIX_TIMESTAMP() to it in your INSERT statement (the format > you want). > > Note that the 10 in INT(10) is the display size, not the size of the > integer. You probably knew that, but just in case... Otherwise, > "int(10) unsigned not null default 0" should be fine. > > Michael > > Keith Bussey wrote: > > > Quoting Michael Stassen <[EMAIL PROTECTED]>: > > > > > >>Defaults must be constants, not functions. > > > > > > Ahh. Thanks for the info. > > > > > >>You want a TIMESTAMP column, not INT. See > >><http://www.mysql.com/doc/en/DATETIME.html>. > > > > > > I want to store my time in unix timestamp format though, not in a mmddyy > type. > > > > > > > >>Michael > >> > >>Keith Bussey wrote: > >> > >> > >>>Hi all, > >>> > >>>I was wondering if it is possible to have the default value of an integer > > >>>field be the current UNIX timestamp ? > >>> > >>>MySQL doesn't allow me to use .... not null default UNIX_TIMESTAMP() > ..... > >>> > >>>If anyone knows a way of achieving this, it would be great =) > >>> > >>>Also, I currently use "int(10) unsigned not null default 0" for my unix > >>>timestamp fields, is there perhaps a more efficient field type I should > be > >> > >>>using? > >>> > >>>Thx > >>> > >> > >> > > > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]