On 24 Apr 2002, Jackson Miller wrote:
> When storing dates and times in databases is it better to store them as
> UNIX timestamps or in one of the SQL date/time types?
> 
> I am working on an application that takes school attendance and has
> homework assignments, so I am doing a fair amount of date work. 
> Currently I am storing everything as date time and referring to a day
> with the UNIX timestamp for  midnight of that day.  I am able to do
> everything I need to do with both formats, but I am wondering if there
> is a performance issue at hand.

If you want to use your database's time functions for comparison or
grouping when selecting data, then it usually makes sense to use the
database's native time format. Easy enough to convert back and forth (it's
usually cheaper to have the database convert to unix timestamps and to
have PHP convert in the other direction, from timestamps to database
format).

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to