Log in

View Full Version : Date()


ender
04-29-2001, 01:26 PM
How can I tell with a date string if the last activity # is two+ weeks old? Is there a number that can show two weeks?

LIke if I have the number: 988515692

How can I check to see if that number is two or more weeks old? Like what would the if statement look like and what else do I need?

ender
04-29-2001, 04:21 PM
Basicially my question is: is that # above in seconds? And when from? If I minus 1209600 from it will that be two weeks ago?

Ahh, this is getting a bit confusing... how is the lastactivity string formatted?

If I do


$postsresult = mysql_query("SELECT userid,username,email,icq,posts,lastactivity FROM user WHERE usergroupid=9 ORDER BY lastactivity desc") or die("Unable to complete query");
while ($topposters = mysql_fetch_array($postsresult)):
if (($counter++ % 2) != 0) {
$bc=$bc1;
} else {
$bc=$bc2;
}
$lasta = $topposters[lastactivity];
$date = date("D, F j, G:i:s",$lasta);
$datea = date("Y-m-d",$lasta);

if(($datea) < ((date("Y-m-d", mktime(0,0,0, date(m), date(d)-7,date(Y))))) {
$bc=$wa;
}
if(($datea) < ((date("Y-m-d", mktime(0,0,0, date(m), date(d)-14,date(Y))))) {
$bc=$wb;
}


Will this work?

Steve Machol
04-29-2001, 04:34 PM
I believe it's seconds since 01-01-1970 and subtracting seconds should work.