【问题标题】:Format the date in Angular 9 with small letter h at the end of the date在日期末尾用小写字母 h 格式化 Angular 9 中的日期
【发布时间】:2020-09-29 13:58:25
【问题描述】:

我正在使用 Angular 9CommonModule DatePipe transform method 喜欢:

this.datePipe.transform(sumDate, 'dd/mm/yyyy HH:mm:ss');

我明白了:

27/20/2020 17:20:14

我只需要一个小写字母 h 在它的末尾,比如:

27/20/2020 17:20:14h

我查看了文档,但找不到任何东西。谢谢。

【问题讨论】:

  • this.datePipe.transform(sumDate, 'dd/mm/yyyy HH:mm:ss') + 'h';?
  • @HereticMonkey 太容易了:'D

标签: angular angular9


【解决方案1】:

您可以通过用'包围文字文本来附加字母h

{{my_date | date: 'yyyy/MM/dd HH:mm:ss\'h\''}}

【讨论】:

    猜你喜欢
    • 2022-01-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多