-1

I'm getting the date in PST TimeZone and need to convert it to local TimeZone. I'm developing a product in CRM so TimeZone can be changed user to user.

I tried to use moment JS but for that, we need to specify the country/ city name and all I'm getting is TimeZoneOffset. I have a code for UTC to local time zone if it gets converted to UTC also then my work will be done.

Fri Jan 17 2020 22:57:49 GMT-0800 (Pacific Standard Time) Need the answer in TS if possible or JS will be ok. Thank you.

Sohail Ashraf
  • 10,078
  • 2
  • 26
  • 42
Sharique Khan
  • 162
  • 2
  • 12

1 Answers1

0

To Convert other time zones to local time zone. You can use the following in javascript.

var date = new Date(other time zone value);
date.toString();

For example

var date = new Date('Fri Jan 17 2020 22:57:49 GMT-0800 (Pacific Standard Time)');
date.toString();

result will be "Sat Jan 18 2020 12:27:49 GMT+0530 (India Standard Time)"