Angular2日期管道自动将时区添加到日期 [英] Angular2 date pipe automatically adding timezone to date

查看:147
本文介绍了Angular2日期管道自动将时区添加到日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个日期字符串,例如1987-06-15T00:00:00.000Z,当我在其上添加日期管道时,该日期在美国时区中显示的日期与Jun 14, 1987不同,但在印度,该日期显示正确.

I have a date string, like this 1987-06-15T00:00:00.000Z, when I am added date pipe on it the date is showing a different date like Jun 14, 1987 in American time zone, but in India, it's showing correct.

<div>{{'1987-06-15T00:00:00.000Z' | date}}</div>

推荐答案

此代码对我有用

<div>{{date_of_birth.split("T")[0] | date}}</div>

这篇关于Angular2日期管道自动将时区添加到日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆