Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 627
Anil Avatar asked Mar 06 '23 09:03

Anil


1 Answers

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');
like image 63
Anil Avatar answered Mar 27 '23 07:03

Anil