Todd Benson wrote: > On Dec 2, 2007 2:44 AM, Mike Mr. <saltydog4791 / gmail.com> wrote: >> since sometimes it will be a single digit and sometimes a double digit, >> >> filename = "November 15, 2007.mp3" >> puts "Wed, " + ( filename[0,3]) + ( filename[-12,2]) > > You could make your life easy by using a Date object and the #parse > method... > > str = "November 15, 2007.mp3" > date_str = str.split('.')[0] > d = Date.parse(date_str) ##### parse it > puts d.strftime "%a, %e %b %Y.mp3" ##### output it the way you want > > You can add other formats too (see #strftime and look at the source) > Todd Thank you so much Todd. I integrated your code successfully and it works great. Kudos to all of you who lent me a hand. Warm regards, Mike -- Posted via http://www.ruby-forum.com/.