I’ve got a Ruby on Rails app that is using MongoDB for datastorage. Mongoid::Timestamp automatically creates created_at and updated_at ISODate timestamps when the records are updated.
Given an input from the user in the form of MM DD YY (three form fields), how can I create an ISODate from this to add a completed_at entry for the record?
I had to write the code for the format (in Ruby 1.8.7) the other day by hand, but Ruby 1.9.2 supports ISO date formatting :
(for more granularity; see http://www.ruby-doc.org/core-1.9.3/Time.html#method-i-strftime)