From: David Douthitt Date: 2000-05-12T12:00:57-05:00 Subject: [ruby-talk:02792] Re: Time Conversions This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=_AAF282DF.A2C3A79C Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Thank you thank you! But now, a few questions... Your code: require 'parsedate' include ParseDate t =3D Time.local(*parsedate("Fri May 12 2000 10:48a")[0,6]) p t # =3D> Fri May 12 10:48:00 CDT 2000 What does the * in *parsedate do? Secondly, matzes code: require 'parsedate' year, month, day, hour, min =3D 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. It also too me a little bit to realize that 5 elements or 6, mktime (or = local) still works - had to go back and read Time::gm from your (WONDERFUL!= ) reference. You might also want to know that the nice header formatting (et al) in = ref_c_time.html is lost right after "to_a" http://www.rubycentral.com/ref/ref_c_time.html#to_a Thank you for all of your hard work on that reference! --=_AAF282DF.A2C3A79C Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Thank you thank you!
 
But now, a few questions...
Your code:
 
  require 'parsedate'
  include ParseDate

  = t =3D=20 Time.local(*parsedate("Fri May 12 2000 10:48a")[0,6])
  p t  = #=20 =3D> Fri May 12 10:48:00 CDT 2000
What does the * in *parsedate do?
 
Secondly, matzes code:
 
  require 'parsedate'

  year, month, day, hour, min = =3D=20 ParseDate.parsedate("Fri May 12 2000 10:48a")
  p Time.mktime(year,= =20 month, day, hour, min)
 
You use the array subscript [0,6] (which I read as the zeroth element = and=20 the sixth element....)  Matz uses [0..4] (which I read as the = zeroth=20 element THROUGH the fourth element.)  I'm sure I misread it, but = that's=20 what it looks like.
 
It also too me a little bit to realize that 5 elements or 6, mktime = (or=20 local) still works - had to go back and read Time::gm from your (WONDERFUL!= )=20 reference.
 
You might also want to know that the nice header formatting (et al) = in=20 ref_c_time.html is lost right after "to_a"
 
http://www.rub= ycentral.com/ref/ref_c_time.html#to_a
 
Thank you for all of your hard work on that reference!
 
--=_AAF282DF.A2C3A79C--