Hi is it possible to calculate the difference between todays date and one stored in a database. So if todays date is 2 weeks after the date in the database table do something like hightlight the result. Thanks
fintan.
jatar_k
8:25 pm on Jan 13, 2005 (gmt 0)
what is the format in the db? timestamp?
fintan
8:45 pm on Jan 13, 2005 (gmt 0)
That will be the one, would you do something like
if($datenow - $dadedb = $setdate){do something}
or is it a bit more complecated?
jatar_k
8:46 pm on Jan 13, 2005 (gmt 0)
just like that, no frills or $datenow - $dadedb = $setdate $datenow - $dadedb >= $setdate $datenow - $dadedb <= $setdate $datenow - $dadedb > $setdate $datenow - $dadedb < $setdate
whichever
fintan
8:48 pm on Jan 13, 2005 (gmt 0)
The thing that gets me is the $setdate how would you set that?
jatar_k
8:52 pm on Jan 13, 2005 (gmt 0)
unix timestamp is done in seconds so
1 day == 24 hrs == 1440 mins == 86400 secs
therefore
2 weeks == 14 days == 1209600 secs
and
$setdate = 1209600; if ($datenow - $dadedb > $setdate) echo 'very old ;)';
[edited by: coopster at 2:13 pm (utc) on Jan. 14, 2005] [edit reason] typo [/edit]
fintan
8:57 pm on Jan 13, 2005 (gmt 0)
Thanks jatar_k your a star that's twice you've saved my bacon. Thanks again.