angularangular-date-format

How to convert Date in angular to another time zone


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');

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


Solution

  • I solved my issue by adding an another parameter for timezone according to https://angular.io/api/common/DatePipe

    Here is the update code:

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