I want to create a DateTime instance that lies 20 minutes and 10 seconds in the future. I tried around with Time and DateTime in irb, but can\'t seem to figure out a way that re
As noted above, you can add seconds
to a Time object, so if you call to_time
on a DateTime object, you can add seconds to it:
DateTime.strptime("11/19/2019 18:50","%m/%d/%Y %H:%M") + 1 => adds a day
(DateTime.strptime("11/19/2019 18:50","%m/%d/%Y %H:%M").to_time) +1 => adds a second
This doesn't require adding gems.