How To Get Yesterdays Date In Ruby Or Rails

Posted by Weston Ganger

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:

Article Topic:Software Development - Rails

Date:February 15, 2016

Recommended Posts

Contact

604-309-8713
info@solidfoundationwebdev.com

Send Me A Message

I would love to get in touch and talk about your next project. Feel free to send a message and I will get back to you shortly.

Get Connected