gpt4 book ai didi

angular - 使用 datepipe 格式化 UTC

转载 作者:行者123 更新时间:2023-12-03 18:40:53 25 4
gpt4 key购买 nike

我想将 UTC 日期时间格式化为“dd/MM/yyyy hh:mm:ss a”。我使用 datepipe 尝试了这个。但是它会将其转换为本地时间。如何将 UTC 格式化为所需的格式。

Stackblitz 链接:
https://stackblitz.com/edit/angular-oxr43w

提前致谢。

最佳答案

日期管accepts a timezone检查文档

<p>
UTC: {{date | date:"dd/MM/yyyy hh:mm:ss a":"+0000"}}
</p>

Check this out

关于angular - 使用 datepipe 格式化 UTC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53934786/

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