Subtract n hours from a DateTime in Ruby April 18, 2023 by Tarik You could do this. adjusted_datetime = (datetime_from_form.to_time - n.hours).to_datetime