[Haskell-beginners] iterating over a range of dates

Rolf Hanson rolf.hanson at gmail.com
Sat Jul 9 18:33:42 CEST 2011


Hi, I'm trying to iterate over a range of dates and print them out.
Here's how I am doing it in Ruby:

'require 'date'

now      = Date.parse('2011-07-11')
end_date = Date.parse('2011-12-31')

(now..end_date).each do |d|
  # print out a date that looks like:
  # Monday, July 11, 2011
  puts "#{d.strftime('%A, %B %d, %Y')}"
end

I've been looking at the docs for Data.Time.Format and Data.Time.Calendar and am a bit puzzled at where to begin. Anyone have ideas? I've not found many (any?) examples of time and date manipulation in Haskell. 

RW


More information about the Beginners mailing list