# Format time as "\_\_\_\_\_\_ ago"

**URL:** <https://www.ruby-forum.com/t/format-time-as-ago/122773>\
**Category:** Rails\
**Created:** [December 12, 2007, 1:03am UTC](https://www.ruby-forum.com/t/format-time-as-ago/122773 "2007-12-12T01:03:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubynuby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ba9def/32.png) [@rubynuby](https://www.ruby-forum.com/u/rubynuby)\
**Post date:** [December 12, 2007, 1:03am UTC](https://www.ruby-forum.com/t/format-time-as-ago/122773/1 "2007-12-12T01:03:56Z")

</div>

a lot of bloggy sites display time as this post was made X hours / X  
days / X months ago. this is so popular I’m sure RoR has a built in  
lib to do it, but I can’t figure it out, searching google and the  
docs. there’s an ago function, but it returns a Time. I need like  
the reverse. Is there one?

---

<div class="post-metadata">

**Author:** ![rubynuby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ba9def/32.png) [@rubynuby](https://www.ruby-forum.com/u/rubynuby)\
**Post date:** [December 12, 2007, 4:13am UTC](https://www.ruby-forum.com/t/format-time-as-ago/122773/2 "2007-12-12T04:13:20Z")

</div>

On Dec 11, 2007, at 12:32 PM, rubynuby wrote:

> a lot of bloggy sites display time as this post was made X hours / X  
> days / X months ago. this is so popular I’m sure RoR has a built in  
> lib to do it, but I can’t figure it out, searching google and the  
> docs. there’s an ago function, but it returns a Time. I need like  
> the reverse. Is there one?

time\_ago\_in\_words

> **[ActionView::Helpers::DateHelper](https://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#M000994)**
>
> Action View Date Helpers The Date Helper primarily creates select/option tags for different kinds of dates and times or date and time elements.

-Rob

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![rubynuby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ba9def/32.png) [@rubynuby](https://www.ruby-forum.com/u/rubynuby)\
**Post date:** [December 12, 2007, 4:02pm UTC](https://www.ruby-forum.com/t/format-time-as-ago/122773/3 "2007-12-12T16:02:48Z")

</div>

thank you 🙂

---

<div class="post-metadata">

**Author:** ![rubynuby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ba9def/32.png) [@rubynuby](https://www.ruby-forum.com/u/rubynuby)\
**Post date:** [December 12, 2007, 9:47pm UTC](https://www.ruby-forum.com/t/format-time-as-ago/122773/4 "2007-12-12T21:47:24Z")

</div>

On Dec 11, 2007, at 11:32 AM, rubynuby wrote:

> a lot of bloggy sites display time as this post was made X hours / X  
> days / X months ago. this is so popular I’m sure RoR has a built in  
> lib to do it, but I can’t figure it out, searching google and the  
> docs. there’s an ago function, but it returns a Time. I need like  
> the reverse. Is there one?

distance\_of\_time\_in\_words
