2

In drupal, I enabled Date module and added Date (Unix timestamp) to a content type, my question is instead of display the date how do I display the remaining time?

Highly appreciate your help!

Muhammad Reda
  • 26,379
  • 14
  • 93
  • 105
Peter
  • 1,481
  • 4
  • 19
  • 37

2 Answers2

1

Try using format_interval() function.

You can put the following code in your theme's template.php file:

function [YOUR_THEME]_ago($timestamp)
{
    $ago = format_interval((time() - $timestamp) , 2) . t(' ago');
    return $ago;
}

Hope this helps... Muhammad.

Muhammad Reda
  • 26,379
  • 14
  • 93
  • 105
0

Countdown looks promising for what you need.

kyletaylored
  • 719
  • 1
  • 7
  • 16