如何将日期转换成角度到另一个时区 [英] How to convert Date in angular to another time zone

查看:141
本文介绍了如何将日期转换成角度到另一个时区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Date()来获取本地时区的当前时间.我将其格式化如下:

I am using Date() to get the current time in local time zone. And I have formatted that as follows:

this.today = new Date();
      from = new DatePipe('en-Us').transform(this.today, 'dd:MM:yyyy hh-mm-ss');

现在,我想将from日期时间转换为Europe/London时区. 没有moment怎么办? 请帮助我

Now I want to convert the from date time to Europe/London time zone. How Can I do this without moment. Please help me

推荐答案

我通过根据 https://angular.io/api/common/DatePipe

这是更新代码:

to = new DatePipe('en-Us').transform(this.today, 'dd:MM:yyyy hh-mm-ss', 'GMT+1');

这篇关于如何将日期转换成角度到另一个时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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