> I store all dates in unix timestamp format.  It's the easiest one to
> with, and it's easy to do things like "date + three days", because
> just
> a case of adding the right number of seconds to the current stamp.
> You don't have to split anything, or get substr()'s of anything... and
> since
> date() accepts unix timestamps AND is the easiest way to get date
> (for me), I reckon it's the best way to go.

Well, I've got to butt in on this one and put in a big DISAGREE. Use
whatever is easiest for you, but MySQL provides a very rich assortment
of date and time manipulation functions that are a lot better than PHPs
(without any added classes). 

For example, to get everything from your database that was inserted
three days ago, you'd use:

SELECT * FROM your_table WHERE your_date_column = CURDATE() - INTERVAL 3

Now, much of this is MySQL specific, though. I only use MySQL right now,
so it's not an issue, but it can be for some of you. 

Bottom line is use whatever is easiest for you, but realize that there
are a ton of Date and Time functions built into MySQL. Anything you can
do with a PHP function you can do with a MySQL function. You are also
not completely lost if you're storing things as Unixtimstamps. You can
convert from and to unixtimestamps and still make use of all of the
MySQL functions...

---John Holmes...

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

Reply via email to