Currently whenever the timestamp is echo'ed it looks like this
function show_posts($userid){
$posts = array();
$sql = "select body, stamp from posts where user_id = '$userid' order by stamp desc";
$result = mysql_query($sql);
while($data = mysql_fetch_object($result)){
$posts[] = array( 'stamp' => $data->stamp,
'userid' => $userid,
'body' => $data->body
);
}
return $posts;
}
i want to take this stamp and change it so instead of printing 2012-03-26 12:07:52 it will print the day followed by the time etc. below is how i show it on my webpage.
<?php
foreach ($posts as $key => $list){
echo "<tr valign='top'>
";
echo "<td>".$list['userid'] ."</td>
";
echo "<td>".$list['body'] ."<br/>
";
echo "<small>".$list['stamp']."<br/>
<a>Like</a> <a>Flag</a><hr class='span9'/></small></td>
";
echo "</tr>
";
}
?>
Use date_format().