Date.strptime with format '%d/%m/%y' : strptime « Date « Ruby






Date.strptime with format '%d/%m/%y'

require 'date'
european_date = '%d/%m/%y'
puts Date.strptime('2/9/07', european_date).to_s       # => "2007-09-02"
puts Date.strptime('02/09/68', european_date).to_s     # => "2068-09-02"
puts Date.strptime('2/9/69', european_date).to_s       # => "1969-09-02"

 








Related examples in the same category

1.Date.strptime
2.Date.strptime with format '%m/%d/%Y'
3.Date.strptime with format '%A, %B %d, %Y'