How do I count the number of days between these two dates?
start_date = Date.parse "2012-03-02 14:46:21 +0100" end_date = Date.parse "2012-04-02 14:46:21 +0200"
With the Date (and DateTime) classes you can do (end_date - start_date).to_i to get the number of days difference.
(end_date - start_date).to_i
2.1m questions
2.1m answers
60 comments
57.0k users