Skip to content

Instantly share code, notes, and snippets.

@leviwilson
Created May 29, 2013 17:05
Show Gist options
  • Save leviwilson/5671934 to your computer and use it in GitHub Desktop.
Save leviwilson/5671934 to your computer and use it in GitHub Desktop.
String#to_american_date extension
require 'date'
class String
def to_american_date
Date.strptime(self, '%m/%d/%Y')
end
end
"06/05/2013".to_american_date #=> #<Date: 2013-06-05 ((2456449j,0s,0n),+0s,2299161j)>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment