如何将角度中的日期转换为另一个时区

Ani*_*nil 3 angular-date-format angular

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

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

现在我想将from日期时间转换Europe/London为时区。没有moment. 请帮我

Ani*_*nil 6

我通过根据https://angular.io/api/common/DatePipe添加另一个时区参数解决了我的问题

这是更新代码:

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