Dealing with Ruby time

I saw this code the other day:

- tempDate = "#{my_object_date.to_date}"
- displayDate = tempDate[5,2]
- displayDate += "/"
- displayDate += tempDate[8,2]
- displayDate += "/"
- displayDate += tempDate[0,4]
= displayDate

The result of this code is MM/DD/YY.

What the hell?  I am pretty sure that just about every computer language out there has ways to deal with dates.  For Ruby it is strftime.

Check out this awesome tool for dealing with dates and time in Ruby: http://www.foragoodstrftime.com/

And when in doubt, google it!!

comments powered by Disqus