角度6中的时间格式

时间:2018-09-10 11:32:46

标签: angular pipe angular6 time-format

我想将时间格式设置为html文件中的6号角...我现在正在编写此文件,但是它不起作用。

<h5>{{"14:25:23" | date:'hh:mm a'}}</h5>

任何人都可以建议或回答我该怎么办。

3 个答案:

答案 0 :(得分:1)

我认为您正在寻找DatePipe,这是您刚刚在闲暇时see this example找到的答案的链接

答案 1 :(得分:1)

请尝试这个

{{ dateObj | date:'medium' }}

正在工作:)

答案 2 :(得分:0)

管道没错。您唯一需要更改的就是您的数据格式:

<h5>{{"2019-01-01T14:25:23" | date:'hh:mm a'}}</h5>

输出将为02:25 PM