【发布时间】:2019-02-14 20:04:45
【问题描述】:
我想在 html 文件中以角度 6 格式化时间...我现在正在写这个,但它不起作用。
<h5>{{"14:25:23" | date:'hh:mm a'}}</h5>
任何人都可以建议或回答我该怎么做。
【问题讨论】:
标签: angular pipe angular6 time-format
我想在 html 文件中以角度 6 格式化时间...我现在正在写这个,但它不起作用。
<h5>{{"14:25:23" | date:'hh:mm a'}}</h5>
任何人都可以建议或回答我该怎么做。
【问题讨论】:
标签: angular pipe angular6 time-format
我认为您正在寻找 DatePipe,这里是我刚刚在 slack see this example 中找到的答案的链接
【讨论】:
管道没有问题。您唯一需要更改的是数据格式:
<h5>{{"2019-01-01T14:25:23" | date:'hh:mm a'}}</h5>
输出将是02:25 PM
【讨论】:
请试试这个
{{ dateObj | date:'medium' }}
它正在工作:)
【讨论】: