Tuesday, 11 November 2014

remove empty 00 from time

# video_time_to_human("00:05:20")
# => "05:20"
# video_time_to_human("10:05:20")
# => "10:05:20"
def video_time_to_human(time)
time = time.split(":")
time.delete_at(0) if time.first == "00"
time.join(":")
end
view raw gistfile1.rb hosted with ❤ by GitHub

No comments:

Post a Comment