date - 如何显示格式日期:dd/MM/yyyy 10:05 pm
问题描述
我正在使用日期管道来格式化我的日期,但我无法获得想要显示 dd/MM/yyyy 小时 PM/AM 的确切格式
解决方案
您可以使用日期管道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
推荐阅读
- javascript - 了解 ES6 模块导入/导出
- dart - 如何打开本机文件资源管理器以在颤动中定位目录?
- asp.net - 数据库从 Sybase 12.5 升级到 15 后 ASP 经典应用程序出现数据问题
- android - Firebase LogEvents 在 web 视图中作为双打
- javascript - 从 css SelectorText 中可靠地删除 ":hover/:focus"
- javascript - 为什么我添加新按钮和列表的东西,它不会做请求 1 和 2?
- c++ - std::cout 在 QNX 中 \n 之后不打印字母
- php - Symfony 教义试图插入一个空主键
- r - 动态创建的滑块中的数学表达式
- linux - 用另一个变量替换文本文件中的变量