Last Updated: September 09, 2019
·
1.053K
· robinvdvleuten

Format a timestamp as time ago in Drupal

Formatting a date as time ago in Drupal is very easy and requires the following code:

format_interval(time() - $node->created, 1) . ' ' . t('ago');