I've used Timestamp with the ON UPDATE CURRENT_TIMESTAMP attribute a few times for quick things that I've put up where I wanted to be able to easily enter stuff into a table via sql in addition to my script and not have to worry about the modified.

Usually for date/times though, I end up using a unix timestamp and store it in an INT field and just do all of my processing in php. I like having total control in the php side of things. I'm not that into stuff like stored procedures either. I'd rather keep all the logic in one system and just use the database for storage. It feel like it could come back to bite me if MySQL was doing too much on its own... although there are plenty of good arguments for going that route.

The reason I use a unix timestamp is I like how easy it is to find the difference between two times -- just subtract one from the other -- plus I can rely on it being portable for the systems I work with. MySQL does have a FROM_UNIXTIME() and UNIX_TIMESTAMP() functions too if you don't feel like writing date() and time() in your php code.


_______________________________________________
New York PHP Community MySQL SIG
http://lists.nyphp.org/mailman/listinfo/mysql

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to