BrunoMiranda.com

Personal Blog about Software Engineering, Design, Travel & More

relative_time_helpers Plugin

Posted on June 11, 2007 at 12:42 PM

Very useful plugin that formats timestamps to human-friendly relative dates.

<%= relative_time(Time.now) %>
# today
<%= relative_time(1.day.ago) %>
# yesterday
<%= relative_time(1.day.from_now) %>
# tomorrow
<%= relative_time_span([Time.now, 5.days.from_now]) %>
# May 17th - 22nd

To install:

script/plugin install http://ar-code.svn.engineyard.com/plugins/relativetimehelpers

Tags: ruby, time
Hierarchy: previous, next

Comments

There are 0 comments on this post. Post yours →

Post a comment

Required fields in bold.

 

Visit the Archives →