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 


Want me to help develop your next project or application?

Contact Us

Specializing in Ruby-on-Rails, Javascript, Multi-Platform Electron Desktop Apps and Hybrid Cordova Mobile Apps.

Recommended Posts