T
tony summerfelt
i was porting some perl log parsing code over to ruby. final results
were weird. i've been scratching my head over a bug for the last hour
until i finally decided to create the minimal program that recreates
it.
a timestamp line logged yesterday:
02/03/05 22:30:49
that's march 2nd, 2005 est
but this:
require 'time'
t=Time.parse("02/03/05 22:30:49")
puts t
outputs this:
Thu Feb 03 22:30:49 EST 2005
is there any way to parse the line with a specific format (in this
case switching the day and month around.
i could split the line up, rearrange manually and use t.strftime but
that's closer to what my perl code was doing (and i was trying to
avoid)
http://home.cogeco.ca/~tsummerfelt1
telnet://ventedspleen.dyndns.org
were weird. i've been scratching my head over a bug for the last hour
until i finally decided to create the minimal program that recreates
it.
a timestamp line logged yesterday:
02/03/05 22:30:49
that's march 2nd, 2005 est
but this:
require 'time'
t=Time.parse("02/03/05 22:30:49")
puts t
outputs this:
Thu Feb 03 22:30:49 EST 2005
is there any way to parse the line with a specific format (in this
case switching the day and month around.
i could split the line up, rearrange manually and use t.strftime but
that's closer to what my perl code was doing (and i was trying to
avoid)
http://home.cogeco.ca/~tsummerfelt1
telnet://ventedspleen.dyndns.org