How to add 10 days to current time in Rails

前端 未结 6 995
一向
一向 2020-12-07 12:38

I tried doing something like

Time.now + 5.days

but that doesn\'t work, even though I vaguely remember seeing, and being very impressed, wi

6条回答
  •  无人及你
    2020-12-07 13:32

    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.

提交回复
热议问题