首页 > 解决方案 > 如何显示格式日期:dd/MM/yyyy 10:05 pm

问题描述

我正在使用日期管道来格式化我的日期,但我无法获得想要显示 dd/MM/yyyy 小时 PM/AM 的确切格式

标签: dateformatangular5

解决方案


您可以使用日期管道this.datePipe.transform(new Date() ,'dd/MM/yyyy HH:mm a'); 如果要显示小写,可以添加管道lowercase

{{ today | lowercase }}

更多格式在https://angular.io/api/common/DatePipe

演示https://stackblitz.com/edit/angular-datepipe-in ​​-component-test-2


推荐阅读