how to convert 270921sec into days + hours + minutes + sec ? (ruby)

前端 未结 9 622
不知归路
不知归路 2020-12-02 06:09

I have a number of seconds. Let\'s say 270921. How can I display that number saying it is xx days, yy hours, zz minutes, ww seconds?

9条回答
  •  心在旅途
    2020-12-02 06:26

    Rails has an helper which converts distance of time in words. You can look its implementation: distance_of_time_in_words

提交回复
热议问题