Help us understand the problem. What is going on with this article?

【ruby】整数で出力した秒を「00:00:00」の形式で出力

動画の開始位置は●秒、終了位置は●秒、その部分の再生時間は?

という計算をしたいと思ったので調べてみました。
「movie_time.strftime('%X')」みたいな感じで簡単にできると思ったら、
Timeメソッドなるものの力を借りなきゃいけないようでした。

time.rb
start = 30
stop = 79
movie_time = stop - start
movie_time = Time.at(movie_time).utc.strftime('%X')
puts movie_time

参考記事

Ruby on Railsで秒で指定した時間を時:分:秒に変換する
https://marketing-web.hatenablog.com/entry/second_to_00-00-00

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away