[prev in list] [next in list] [prev in thread] [next in thread] 

List:       nyphp-mysql
Subject:    Re: [mysql] Datetime or timestamp data type
From:       Rob Marscher <rmarscher () beaffinitive ! com>
Date:       2007-07-24 3:26:57
Message-ID: 268CB12F-0DCC-4259-AF0E-5398C90F0E78 () beaffinitive ! com
[Download RAW message or body]

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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic