I wanted to get the difference between two dates. My date are in format “DD/MM/YYYY”. I tried to get number of days between two date of same format. Finally I got an easy method to get number of day between these two date.
For this first of all I changed these date to date format using following method.
d1 = “12/2/2012”
d2 = “15/2/2012”
d1 = d1.to_date
d2 = d2.to_date
no_of_days = (d2-d1).to_i
Finally, I get number of days between two date. If there are any better methods for this operation, suggestions are welcome.