I'm inserting some strings (that look dates) into a sqlite3 database via my ActiveRecord and the database is altering the field and making it look like a date. For example:
"4-2" => "2-Apr" #Not only a date but the order has been reversed.
"6-7-12" => "7/12/2006" #Again not only a date but the order has been changed.
I looked for a ruby string function that would prevent this from happening but haven't been able to come up with anything.
Has anyone else come across something like this and are you aware of any workarounds or fixes.
If you can predict the format of the string, use the following code to parse the string into date object before saving it.
Date.strptime '6-7-12', '%m-%d-%y'
=> Thu, 07 Jun 2012