I have this code that converts an array of date strings from a format of 17-Nov-2011 to 11/17/11:
def date_convert dates
months = { \'Jan\' => 1, \'Feb\
With Date#strftime you can format a date. Date.strptime allows you a 'reverse' action: Build a date from string.
When you combine both, you get your result:
puts Date.strptime('17-Nov-2011', '%d-%b-%Y').strftime('%m/%d/%y')
Each %-Parameters is a part of the date string.
You need:
For parsing the date string:
For creating the string: