Mega Code Archive

 
Categories / Ruby / Time
 

Add seconds and multiples of seconds to add to a time with +

stop = Time.local( 2007, "jan", 30, 1, 15, 20 ) stop.inspect  # Add a minute (60 seconds) stop + 60  # Add an hour (60*60) stop + 60*60  # Add three hours (60*60*3) stop + 60*60*3  # Add a day (60*60*24) stop + 60*60*24