5

I want to display # Days Ago, or # Months Ago, or # Years Ago

Example: 3 Days Ago

I need to add custom symbols in the Date field in views.

enter image description here

1

I think it's best for you to use the Timeago module: https://www.drupal.org/project/timeago

First, it provides a timeago date formatter option for use with dates anywhere, which answers your need.

Second, it solves the caching and correctness of time-ago dates problem for you automatically. Even though you don't mention this in your question, this is important as it's best to cache pages in live production in one way or another.

Good luck.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.