How can I convert a time like 10:30 to seconds? Is there some sort of built in Ruby function to handle that?
Basically trying to figure out the number of seconds fro
require 'time' def seconds_since_midnight(time) Time.parse(time).hour * 3600 + Time.parse(time).min * 60 + Time.parse(time).sec end puts seconds_since_midnight("18:46")
All great answers, this is what I ended up using.