From: Robert Klemme Date: 2012-01-17T17:48:47+09:00 Subject: Re: Parsing log with date time entry On Mon, Jan 16, 2012 at 11:56 PM, Christopher Graves wrote: > The log file looks like this > > 01/10/2012 14:46:02:87 Some Data > 01/10/2012 14:46:03:319 Some Stuff > 01/10/2012 14:46:04:160 OMFG > 01/10/2012 14:46:04:160 okay > > I have the script to the point where it grabs all the logs, sorts > through them and spits out the lines with the specified date/time into a > separate file. > > What would be the best way to get the current time formatted per the log > entries and collect a range of times say from current to 15 minutes > previously. I am not sure what you mean by "collect a range". Parsing can be done like this: require 'time' t = Time.strptime('01/10/2012 14:46:02:86', '%m/%d/%Y %H:%M:%S:%L') Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/