Hey guys, So I have a timestamp that goes something like 1219169855 -- that What I need is to create a php string that would transform that timestamp into "User did this XX minutes ago" Googling didn't help much, so how can I do that? I've got this in my php code <? $data = mysql_query("SELECT * FROM gg_event ORDER BY id DESC LIMIT 20"); while($row = mysql_fetch_array($data)) { echo " .$row[client_abr]. [I want the timestamp to be here] "; } ?> .$row[timestamp]. would be the call for the timestamp. How do I transform it into "XX minutes ago" ? I've got an extra $2 in my paypal to anyone whos advice actually helps
Let's assume your timestamp is in $row[timestamp]. // time() is the call for the current timestamp. $currtime = time(); $timesince = $currtime - $row['timestamp']; // It's currently in seconds. Let's put it into minutes. $timesince = $timesince / 60; // $timesince is now your time since last action. echo 'This was done' . $timesince . ' minutes ago'; PHP:
<? // time() is the call for the current timestamp. $currtime = time(); $timesince = $currtime - $row['timestamp']; // It's currently in seconds. Let's put it into minutes. $timesince = $timesince / 60; // $timesince is now your time since last action. // Create a connection to your database. // Query database and select the last 10 entries. $data = mysql_query("SELECT * FROM gg_event WHERE user_id='{$id}' ORDER BY id DESC LIMIT 25"); while($row = mysql_fetch_array($data)) { echo " ".$row[client_name]." 'This was done' . $timesince . ' minutes ago' <br> Is this correct? If it is, it doesn't work. go 'This was done' . 205....0667 . ' minutes ago' This is what it shows up the timestrap is cloaked by skype "; } ?> </div>