Rails

How To Get Yesterdays Date In Ruby Or Rails

Posted by Weston Ganger on February 15, 2016

Rails has some awesome date & time methods.

Here’s a few to get the previous date.


# Ruby
Date.today.prev_day

# Rails
Date.yesterday
1.day.ago
Date.today - 1.day


Related External Links:


Posted in Rails and Tagged with rails ruby date 


Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts