From: "Florian Aßmann" Date: 2007-09-03T08:49:14+09:00 Subject: Re: extract a range start/end? Ok, I though you were familiar with some of the RubyDoc ressources... Here I go: ParseDate and Date are part of the Ruby StdLib, therefore in order to use this you need to: require 'parsedate' require 'date' Next thing I think you expect something like '1/20/2007' as dateformat: ./my_app.rb --startdate 1/20/2007 This 'll be parsed by: ParseDate.parsedate('1/20/2007') # => [2007,1,20,nil,nil,nil] To generate an instance of Date out of this we simply call Date.new, but wait, Date.new only accepts 3 args (maybe 4, though). Therefore I invoke the slice-method ([]) on the freshly baken array: # I assume i = '1/20/2007' ParseDate.parsedate(i)[0, 3] # => [2007,1,20] To split the array into seperate arguments when I invoke Date.new I need the *-Operator: a_method(*[1,2,3]) is like a_method(1,2,3) Date.new(*ParseDate.parsedate(i)[0, 3]) # => Tada, you got your Date now... Further reading: Ruby Stdlib: Date and ParseDate Ruby Classes and Libraries: Array.slice Regards Florian