changing string to date field in rails mysql -


i wanna convert data type string date format. using mysql database. values stored in "mm/dd/yyyy" format. if try convert string date using .to_date function date values "02/28/2017", throwing invalid date error. so, decided convert datatype. suppose if convert datatype using migration happens existing records? records important. should now?

rails g migration change_date_format_in_my_table  class changedateformatinmytable < activerecord::migration   def     change_column :my_table, :my_column, :date   end    def down     change_column :my_table, :my_column, :string   end end 


Comments

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -