Rails - Get the time difference in hours, minutes and seconds

前端 未结 5 1045
無奈伤痛
無奈伤痛 2020-12-15 16:17

I\'m looking for an idiomatic way to get the time passed since a given date in hours, minutes and seconds.

If the given date is 2013-10-25 23:55:00 and the current

5条回答
  •  半阙折子戏
    2020-12-15 16:39

    Once you get the time difference in seconds, you could do something like this

    Time.at(t).utc.strftime("%H:%M:%S")
    

    Where t is the time difference in seconds

提交回复
热议问题