From: Robert Klemme Date: 2011-03-09T07:25:26+09:00 Subject: Re: formating date information On 08.03.2011 22:45, rob stanton wrote: > Very new to this so can anyone tell me how to change the date format > from 20100901 to something like 01-09-2010 ? > I have a number of dates like => [["20100824"], ["20100825"], > ["20100826"]], Your Array should really contain Date instances and not String instances. Usually parsing is done when the data is read from some external source (command line, file, prompt) so you can continue to work with proper methods of the particular type. > Date.parse("20100824").strftime("%d %b %Y") # thanks Robert > => "24 Aug 2010" > > but how do I parse each date in turn and get a new array with the > standard date format ??? Not sure what you mean. Is it this? irb(main):003:0> Date.strptime("24 Aug 2010", "%d %b %Y") => # irb(main):004:0> Date.strptime("24 Aug 2010", "%d %b %Y").to_s => "2010-08-24" Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/