How to add 10 days to current time in Rails
Use
Time.now + 10.days
or even
10.days.from_now
Both definitely work. Are you sure you're in Rails and not just Ruby?
If you definitely are in Rails, where are you trying to run this from? Note that Active Support has to be loaded.
days
, years
, etc., are part of Active Support, So this won't work in irb
, but it should work in rails console
.
This definitely works and I use this wherever I need to add days to the current date:
Date.today + 5