From: "Jesús Gabriel y Galán" Date: 2008-04-23T17:02:46+09:00 Subject: Re: Extract date from filenames using regex On Wed, Apr 23, 2008 at 9:50 AM, Jesús Gabriel y Galán wrote: > On Wed, Apr 23, 2008 at 9:14 AM, Clement Ow > > wrote: > 1.- Change DateTime.parse to DateTime.strptime passing a format > that describes where in the string you have the two digits of the day, the month > and the four digits of the date. I haven't been able to gather a quick example, > cause I don't find a reference for the format string (any help here > appreciated). > The doc refers me to the date/format.rb for details and I don't see > anything clear > there. After a couple of trial/error tests this seems to work: DateTime.strptime "16042008", "%d%M%Y" So any of the two solutions will work for you. Jesus.