Jump to content

date format help.


ricky_vancouver

Recommended Posts

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]

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.