...

View Full Version : Timestamp Convert



Idfk
12-10-2010, 02:13 AM
Can anyone tell me the problems with this?



public function timestampConvert($timestamp){
$difference = time() - $timestamp;
if($difference < 24) {
return "Today";
}else{
$difference = round($difference / 24);
if($difference < 1) {
return "Yesterday";
}
}
}

dniwebdesign
12-10-2010, 04:59 AM
The timestamp is in seconds... so your line
$difference = time() - $timestamp;
if($difference < 24) { I am thinking the 24 means hours? If so that should actually be
if($difference < (24*60*60))
As goes with the rest of your script.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum