AngularJS:如何用格式打印持续时间? [英] AngularJS: How to print out duration time with format?
本文介绍了AngularJS:如何用格式打印持续时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用下面的代码打印持续时间:
I use below code to print the time duration:
{{(endTime - startTime) * 1000 | date: 'H:mm:ss'}}
但我得到GMT的时间+8
But I get the time of GMT +8
AngularJS有什么方法可以打印出非兑换duaration,
或者我需要用这种方式来做这件事吗?
AngularJS has any way to print out the non-convert duaration, Or I need to use this way to do this?
{{(endTime - startTime) % (60 * 60 * 24) / (60 * 60) | number: 0}}:
{{(endTime - startTime) % (60 * 60) / 60 | number: 0}}:
{{(endTime - startTime) % 60 | number: 0}}
推荐答案
date
过滤格式化 Unix时间戳(以毫秒为单位,所以它不适用于持续时间。
The date
filter formats a Unix timestamp (in milliseconds), so it doesn't work on durations.
你必须像你建议的那样进行手动格式化。
You'll have to do manual formatting, like you suggest.
这篇关于AngularJS:如何用格式打印持续时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文