【问题标题】:Play framework convert seconds to time format in scala.html播放框架在 scala.html 中将秒转换为时间格式
【发布时间】:2016-06-13 12:27:33
【问题描述】:

播放框架 2.4.4

一个名为“time.scala.html”的html文件,如下所示:

@(seconds: Long)(session: play.mvc.Http.Session)
<html>
  <head>
   ...
  </head>
  <body>
    <div>
      <h3>Go to sleep at: </h3>
      <h3>????????</h3>
  </body>
</html>

如何将秒转换为时间格式,如 "HH:MM:SS" 使用 scala,当 seconds=75900 时,显示:

Go to sleep at: 
21:05:00

21:05:00 等于秒:((21*60)+5)*60 = 75900

【问题讨论】:

标签: html scala playframework


【解决方案1】:

我更喜欢这样的:

new DateTime(seconds * 1000).toString("HH:mm:ss")

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-08-27
    • 2019-03-04
    • 2020-08-04
    • 1970-01-01
    • 2019-07-04
    • 2023-03-03
    • 2023-04-07
    相关资源
    最近更新 更多