in Ruby, conversion of float integer into %H %M %S time -


how convert float, 13.5, corresponding 24-hour time %h:%m:%s? (13.5 13:30:00, 8.25 8:15:00) i'm still figuring time class...it confuses me

sec = (13.5 * 3600).to_i min, sec = sec.divmod(60) hour, min = min.divmod(60) "%02d:%02d:%02d" % [hour, min, sec] # => "13:30:00" 

Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -