> Anyone know how to convert date format of .csv to . yaml?
>
> .csv date format:
>
> 12/1/2011
>
> .yaml date format:
>
> 2011-01-12

Another option could be to parse the String into a Date that is then
naturally marshaled into the right format.  That could help make the
intent of the code more clear than splitting and re-arranging by hand,
but note that Date.parse changed from Ruby 1.8 to Ruby 1.9.

Ruby 1.8
    >> require 'date'
    => true
    >> require 'yaml'
    => true
    >> d = Date.parse('12/1/2011')
    => #<Date: 4911793/2,0,2299161>
    >> puts d.to_yaml
    --- 2011-12-01
    => nil

Ruby 1.9
    >> require 'date'
    => true
    >> require 'yaml'
    => true
    >> d = Date.parse('12/1/2011')
    => #<Date: 2011-01-12 (4911147/2,0,2299161)>
    >> puts d.to_yaml
    --- 2011-01-12
    => nil

In practice, I sometimes just split it by hand, but I usually try to
use strptime:

Ruby 1.8 and 1.9:
    >> d = Date.strptime('12/1/2011', '%d/%m/%Y')
    => #<Date: 2011-01-12 (4911147/2,0,2299161)>
    >> puts d.to_yaml
    --- 2011-01-12
    => nil