i use seconds in place of time alot.
using the PHP time() function and Date() functions u can do a lot.

instead of a time / date TIMESTAMP field type i use an INT type
i then call the $the_time = Time(); and insert that.
then u can manipulate the hell outta that INT value from the DB with php's
Date() function.

allows u to compare lengths between times and perform much simplier numeric
math on the values
rather then the 'calender' math. somethings can be trickier like Leaps and
stuff, but i found more pors for most of my application needs.

Same data sizes : INT or TIMESTAMP in mysql are 4 bytes
and they both give u down to the second.

then to find out today, u just run Date('m-d-Y');
compare those vals to Date('m-d-Y', $DB_VALUE);

there u go.... it is today or it isnt ! out put data accordingly.


"Alexander Ross" <[EMAIL PROTECTED]> wrote in message
> I have a column in one of my mysql tables which holds the date & time that
> the record was inserted.  When I run a query later on I want to display
> date, but if the date is today or yesterday I want to display "today" or
> "yesterday" instead .. how do i compare to stored date with todays date?
> todays date -1?  Thanks

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

Reply via email to