格式日期时间在Angular JS [英] Format Date time in Angular JS
本文介绍了格式日期时间在Angular JS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在Angular JS中正确显示日期时间
How to properly display date time in Angular JS
下面的输出显示输入和输出(带/不带角度日期过滤器)
Below output shows the input and the output (with/without angular date filter)
In: {{v.Dt}}
Angular: {{v.Dt | date:'yyyy-MM-dd HH:mm:ss Z'}}
p>
prints:
In: 2012-10-16T17:57:28.556094Z
Angular: 2012-10-16T17:57:28.556094Z
所需的显示格式为
2010-10-28 23 :40:23 0400
或 2010-10-28 23:40:23 EST
推荐答案
v.Dt可能不是Date()对象。
v.Dt is likely not a Date() object.
请参阅 http://jsfiddle.net/southerd/ xG2t8 /
但在您的控制器中:
scope.v.Dt = Date.parse(scope.v.Dt);
这篇关于格式日期时间在Angular JS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文