can anyone help please. i have this script which converts mysql timestamp from the horrible standard date and puts it in a user friendly way "about 2 seconds ago or about 1 hour ago".
my question is this. it works perfectly apart from, when a user posts content, the most recent content they post echos out " about 0 ago" not giving the time it was posted and it isnt until they post something else after this that they see the time on the one they posted before this.
so im wondering why this is because i cant figure it out, i preferabley want it to say "added just now" as soon as the users posted it, and then carry on as the script says saying added 20 seconds ago, 2 minutes ago etc.
an example is;
(content 1) "posted about 0 ago" (content 2) "posted about 8 minute ago" (content 3) "posted about 5 hours ago"
then content 1 will only every update the time when another piece of content is posted else it wont.
so content 1 should say posted just now, then after a few seconds, post about 5 seconds ago, 1 minute ago, 5 hours ago, 7 days ago etc.
<div class="board-wall-feeds">
<div class="social_header">
<?php echo "$profile[2]" ?>'s News & Updates:
</div>
<?php
$timeline_set = get_timeline();
while ($news = mysql_fetch_array($timeline_set)) {
echo "
<div class=\"news_feeds_board_text\">{$news['content']}
<div class=\"social_footer\">about ".$t.$labels[$i]." ago<a href=\"../../../delete_news_post.php?to=".$news['id']."</div><div class=\"social_clip\"></div></div></a>";
$datetime1 = new DateTime();
$datetime2 = new DateTime ($news['date_added']);
$interval = $datetime1->diff($datetime2);
$mdhms = explode('-',$interval->format('%m-%d-%H-%i-%s'));
$labels = Array(' months', ' days', ' hours', ' minutes', ' seconds');
$i = 0;
foreach($mdhms as $t){
if($t > 0) break;
$i+=1;
}
} ?>
</div>