gpt4 book ai didi

javascript - 如何以 Angular 将 '2019-02-22T12:11:00Z' 格式转换为 'DD/MM/YYYY HH:MM:SS' 格式

转载 作者:行者123 更新时间:2023-11-29 23:05:46 25 4
gpt4 key购买 nike

我正在研究一些 API clockify API 集成。我正在从 API 获取所有时间条目。在响应中,我在 2019-02-22T12:11:00Z 中获取任务的开始和结束时间。

我想将上述日期格式转换为 DD/MM/YYYY HH:MM:SS 格式。我为此使用了日期管道 {{item.timeInterval.start | date: dd/MM/yyyy, h:mm a z}} 但它不起作用。它显示相同。

我怎样才能做到这一点?

最佳答案

尝试像这样使用解析成 Date 对象 -

parseIntoDate(date){
return Date.parse(date)
}

<p>{{parseIntoDate(item.timeInterval.start) | date: 'dd/MM/yyyy, h:mm a z'}}</p>

Working Example

关于javascript - 如何以 Angular 将 '2019-02-22T12:11:00Z' 格式转换为 'DD/MM/YYYY HH:MM:SS' 格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54822315/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com