【问题标题】:Ruby: format number of seconds to formatted time [duplicate]Ruby:格式化秒数到格式化时间[重复]
【发布时间】:2010-11-16 01:30:48
【问题描述】:

可能重复:
Can Ruby print out time difference (duration) readily?

我有一个存储为秒数的时间长度。有没有办法将其格式化为 HH:MM 格式或人类可读的格式,例如“2 小时 15 分钟”?

【问题讨论】:

    标签: ruby


    【解决方案1】:

    最简单的可能是修改此 rails 函数中使用的代码:http://apidock.com/rails/ActionView/Helpers/DateHelper/distance_of_time_in_words

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-05-12
      • 1970-01-01
      • 2017-04-10
      • 2019-08-19
      • 2013-05-27
      • 2019-02-27
      • 1970-01-01
      • 2013-03-12
      相关资源
      最近更新 更多