From: Dave Thomas Date: 2000-05-12T12:35:10-05:00 Subject: [ruby-talk:02797] Re: Time Conversions "David Douthitt" writes: > t = Time.local(*parsedate("Fri May 12 2000 10:48a")[0,6]) > p t # => Fri May 12 10:48:00 CDT 2000 > > What does the * in *parsedate do? Converts the array into a list of parameters. > > Secondly, matzes code: > > require 'parsedate' > > year, month, day, hour, min = ParseDate.parsedate("Fri May 12 2000 10:48a") > p Time.mktime(year, month, day, hour, min) > > You use the array subscript [0,6] (which I read as the zeroth > element and the sixth element....) Matz uses [0..4] (which I read > as the zeroth element THROUGH the fourth element.) I'm sure I > misread it, but that's what it looks like. [0,6] means 6 elements starting at 0. [0..4] means element 0 through element 4 (5 in all). Matz left off the seconds because your original time didn't include seconds. > You might also want to know that the nice header formatting (et al) > in ref_c_time.html is lost right after "to_a" Sigh... Thanks. Regards Dave