ricky_vancouver Posted December 11, 2010 Share Posted December 11, 2010 Anyone know what's up with this? <?php $days = floor($posts['timestamp'] / (60 * 60 * 24)); $remainder = $posts['timestamp'] % (60 * 60 * 24); $hours = floor($remainder / (60 * 60)); $remainder = $remainder % (60 * 60); $minutes = floor($remainder / 60); $seconds = $remainder % 60; if($days > 0) { echo date("d/m/y", $posts['timestamp']); echo " at "; echo date("H:i", $posts['timestamp']); }elseif($days == 0 && $hours == 0 && $minutes == 0) { echo "few seconds ago"; }elseif($days == 0 && $hours == 0) { echo $minutes.' minutes ago'; }elseif($days == 0 && $hours > 0){ echo $hours.' hour ago'; }else{ echo "few seconds ago"; } ?> [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/221288-date-format-help/ Share on other sites More sharing options...
trq Posted December 11, 2010 Share Posted December 11, 2010 Not without a description of the problem. Quote Link to comment https://forums.phpfreaks.com/topic/221288-date-format-help/#findComment-1145660 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.