具有角度的人类可读日期的时间戳 [英] Timestamp to human readable date with angular
本文介绍了具有角度的人类可读日期的时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有内置的过滤器以将我的unix时间戳转换为人类可读的日期格式?
Is there a built in filter in angular to convert my unix timestamp to a human readable date format?
我尝试过以下内容:
{{ ::time | date:"medium" }}
但它给出了错误的结果:
But it gives wrong results:
1232346882 gives Jan 15, 1970 7:19:06 AM
我该如何解决这个问题?
How can I fix that?
推荐答案
您需要将秒数转换为毫秒...尝试一下 1232346882000
。
You need to convert seconds to milliseconds... Try it with 1232346882000
.
{{ 1232346882000 | date:"medium" }}
这篇关于具有角度的人类可读日期的时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文