How to Convert UTC to Local Time in JavaScript
In this tutorial, We have shared with you How to convert UTC date-time into local date-time using JavaScript toLocaleString() function. The toLocaleString() method returns a string with a language sensitive representation of this date.
Let’s try out the following example to understand how this method works:
1 2 3 |
// Convert UTC to Local date&Time var theDate = new Date(Date.parse('11/19/2021 4:41:48 PM UTC')); console.log("Local date&Time: ", theDate.toLocaleString()); |