【问题标题】:Changing the date format not working in ng-grid angular js更改日期格式在 ng-grid angular js 中不起作用
【发布时间】:2015-05-01 21:36:14
【问题描述】:

我正在为我的 UI 使用 ng-grid 表。 这具有日期列之一。我以 yyyy/mm/dd 格式发送日期值,但在 UI 上以 yyyy/mm/dd 00:00:00 格式显示。我不确定它在哪里得到改变。 此外,我尝试使用 cellFilter 更改其格式,但这似乎也不起作用。

这是我的 JS 代码:

columnDefs: [{ field: "HostName", width: 120, pinned: true, cellTemplate: linkCellTemplate  },
		    { field: "SerialNumber", width: 120 },
			{ field: "StartDate", width: 160, displayName:"Warranty Start Date" },
			{ field: "ExpDate", width: 160,displayName:"WarrantyExpDate",cellFilter: "WarrantyExpDate:\'yyyy/MM/dd\'"},
             { field: "DateReceived", width: 130, displayName:"Date Received"  },
             ...........
             
             }

请帮帮我。提前致谢。

【问题讨论】:

  • 请注意上面的代码不是完整的代码,它只是我使用cellFilter的部分代码。

标签: java javascript angularjs jsp web


【解决方案1】:

改变这个:

cellFilter: "WarrantyExpDate:\'yyyy/MM/dd\'"

到这里:

cellFilter: "date:\'yyyy/MM/dd\'"

【讨论】:

    猜你喜欢
    • 2017-07-29
    • 1970-01-01
    • 1970-01-01
    • 2022-12-07
    • 1970-01-01
    • 1970-01-01
    • 2014-05-05
    • 2016-04-03
    • 1970-01-01
    相关资源
    最近更新 更多