使用Angular网格以AM/PM格式显示时间 [英] Displaying time in AM/PM format with Angular grid

查看:93
本文介绍了使用Angular网格以AM/PM格式显示时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我该如何格式化接收具有日期时间属性(称为startTime和endTime)的实体的Angular网格,以AM/PM格式显示时间?现在我正在使用:

How would I format an Angular grid that is receiving entities that have a date time property called startTime and endTime to show time in an AM/PM format? Right now I am using:

{ field: 'StartTime', displayName: 'Start Time', cellFilter: 'date:\'hh:mm tt\''},
{ field: 'EndTime', displayName: 'End Time', cellFilter: 'date:\'hh:mm tt\''},

,显然显示的是"tt"而不是AM或PM.以前有人在Angular ngGrid中做过AM/PM吗?

and obviously the 'tt' is showing instead of AM or PM. Has anyone done AM/PM in an Angular ngGrid before?

推荐答案

很简单,请参见:

{ field: 'createdOn', displayName: 'Created On', width: '180px', 
 cellTemplate: 
"<div class='ngCellText'>{{row.entity.createdOn | date:'MM/dd/yy h:mm:ss a'}}</div>" },

就这样

有关日期格式的详细信息,请参见

这篇关于使用Angular网格以AM/PM格式显示时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆