Play框架在scala.html中将秒转换为时间格式

时间:2016-03-01 07:24:05

标签: html scala playframework

播放框架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>

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

Go to sleep at: 
21:05:00

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

1 个答案:

答案 0 :(得分:0)

我更喜欢这样的东西:

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