Skip to Navigation | Skip to Content



Enumerate a range of dates with Ruby | May 5th, 2008

Quick snippet, having fun with dates.


require 'rubygems'
require 'activesupport'

date_range = (DateTime.now-10.days)..DateTime.now

date_range.each { |e| puts e }

Posted in Uncategorized | 1 Comment » | Add to Delicious | Digg It

This entry was posted on Monday, May 5th, 2008 at 4:14 pm and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response to “Enumerate a range of dates with Ruby”

  1. Alexei Says:

    AGAIN this was useful! Thanks for blogging it.

Leave a Reply