Guys. .i need your help. .i want code which informing users when the sh0ut is shouted. .i am talking about the time. .like 2 mins. ago, 4 days ago, 51 secs. ago like in fb. .my script is lavalair. .please help me. .i am a new php learner. .
Help with shout time posted
Collapse
X
-
in my old script i used this
use this likePHP Code:function ponick_time ( $start, $end = false) { if ($end == false) //if you don't pass a second parameter, $end = time(); //we assume you're comparing to now. $tme=date("h:ia",$start); $dati=date("d/m/y", $start); $diff = $end - $start; $days = floor ( $diff/86400 ); //calculate the days $diff = $diff - ($days*86400); // subtract the days $hours = floor ( $diff/3600 ); // calculate the hours $diff = $diff - ($hours*3600); // subtract the hours $mins = floor ( $diff/60 ); // calculate the minutes $diff = $diff - ($mins*60); // subtract the mins $secs = $diff; // what's left is the seconds; if ($secs < 30) { $returnval = "just now"; } if ($secs > 30) { $returnval = "about $secs second".(($secs>1) ? "s":"")." ago"; } if ($mins > 0) { $returnval = "$mins minute".(($mins>1) ? "s":"")." ago"; } if ($hours > 0) { $returnval = "$hours hour".(($hours>1) ? "s":"")." ago"; } if ($days > 0) { $returnval = "$days day".(($days>1) ? "s":"")." ago"; } if ($days == 2) { $returnval = "Yesterday at $tme"; } if ($days > 2) { $returnval = "$days day".(($days>1) ? "s":"")." ago"; } if ($days ==7) { $returnval = "a week ago"; } if ($days ==30) { $returnval = "a month ago"; } if ($days > 30) { $returnval = "$dati"; } return $return . $returnval; }PHP Code:ponick_time($shouttime);Last edited by Ponick; 01.05.11, 13:43.Find me on facebookPHP Code:/* I don't know everything hehe */
Comment

Comment