InterviewHubPRO
Section Overview
Q176

Question 176 of 521

Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

34%
JavaScript Internals (521 Qs)•Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

How do you convert date to another timezone in javascript

You can use the toLocaleString() method to convert dates in one timezone to another. For example, let's convert current date to British English timezone as below,

javascript
  console.log(new Date().toLocaleString("en-GB", { timeZone: "UTC" })); //29/06/2019, 09:56:00