How to convert UTC date time into local date time using JavaScript ? Last Updated : 30 Dec, 2022 Comments Improve Suggest changes Like Article Like Report Given an UTC date and the task is to convert UTC date time into local date-time using JavaScript toLocaleString() function. Syntax: var theDate = new Date(Date.parse('DATE_IN_UTC')) theDate.toLocaleString() Example 1: This example converts UTC date time into local date time using JavaScript. html <body> <h1 style="color:green;"> GeekforGeeks </h1> <p> Click the button to convert UTC date and time to local date and time </p> <p> UTC date and time: 06/14/2020 4:41:48 PM </p> <button onclick="myGeeks()"> Try it </button> <p id="demo"></p> <script> function myGeeks() { var theDate = new Date(Date.parse( '06/14/2020 4:41:48 PM UTC')); document.getElementById("demo") .innerHTML = "Local date Time: " + theDate.toLocaleString(); } </script> </body> Output: Example 2: This example converts today's UTC date time into local date time using JavaScript. HTML <body> <h1 style="color:green;"> GeekforGeeks </h1> <p> Click the button to convert UTC date and time to local date and time </p> <p id="UTC_DATE"> UTC date and time: 06/14/2020 4:41:48 PM </p> <button onclick="myGeeks()"> Try it </button> <p id="demo"></p> <script> var theDate = new Date().toUTCString(); document.getElementById("UTC_DATE").innerHTML = "UTC date and time: " + theDate function myGeeks() { var theDate = new Date().toLocaleString(); document.getElementById("demo") .innerHTML = "Local date Time: " + theDate.toLocaleString(); } </script> </body> Output: Comment More infoAdvertise with us Next Article How to convert UTC date time into local date time using JavaScript ? romy421kumari Follow Improve Article Tags : JavaScript Web Technologies javascript-date JavaScript-Questions Similar Reads How to get the day and month of a year using JavaScript ? Given a date and the task is to get the day and month of a year using JavaScript. Approach: First get the current date by using new Date().Use getDay() method to get the current day in number format, Map it to the day name.Use getMonth() to get the current month in number format, Map it to the month 2 min read How to calculate the date three months prior using JavaScript ? To calculate the date three months prior using JavaScript, we could use the getMonth() and setMonth() methods. In this article, we are going to learn how to calculate the date three months prior using JavaScript. ApproachFirst, select the date object.Then use the getMonth() method to get the months. 1 min read How to calculate the yesterday's date in JavaScript ? In this article, we will see how to calculate yesterdayâs date in JavaScript. To calculate yesterday's date, you need to have some basic ideas of a few methods of JavaScript. JavaScript getDate() MethodJavaScript setDate() MethodJavaScript getDate() Method: It is an inbuilt JavaScript function that 3 min read How to calculate minutes between two dates in JavaScript ? Given two dates and the task is to get the number of minutes between them using JavaScript. Approach: Initialize both Date object.Subtract the older date from the new date. It will give the number of milliseconds from 1 January 1970.Convert milliseconds to minutes. Example 1: This example uses the c 2 min read How to get the first day of the year in JavaScript ? Given a date/year and the task is to get the first day of the year using JavaScript. Approach 1: Use getFullYear() Method to get the year from the given date.Use the new Date() function to create the new date object using year, month, and day. Example: This example uses the getFullYear() method to g 1 min read How to remove time from date using JavaScript ? Given a Date Object and the task is to remove the time portion from the object using JavaScript. JavaScript split() Method: This method is used to split a string into an array of substrings, and returns the new array. Syntax: string.split( separator, limit ) Parameters: separator: This parameter is 2 min read How to get the current date and time in seconds ? In this article, we will learn how to get the current date & time in seconds using JavaScript build-in methods. We will perform it in 2 ways: Using Date.now() methodUsing new Date.getTime() methodMethod 1: Using Date.now() MethodThe Date.now() method returns the number of milliseconds elapsed si 2 min read How to get Month and Date of JavaScript in two digit format ? To get the Month and Date of JavaScript in two-digit format, we have multiple approaches. In this article, we are going to learn how to get the Month and Date of JavaScript in a two-digit format. Below are the approaches used to get the Month and Date of JavaScript in two-digit format: Table of Cont 3 min read How to Check Whether an Object is a Date ? This article will show you how to check whether the given object is a Date or not. There are two methods to check for date objects, which are described below: Method 1: Using instanceof Operator The instanceof operator checks whether the prototype property of a constructor appears anywhere in the pr 2 min read How to Get the Current Date in JavaScript ? The Date() object is used to access the current date in JavaScript. To get the current date in string format, we can use toDateString() method. The date.toDateString() method converts the given date object into the date portion into a string.SyntaxdateObj.toDateString()JavaScript// Create a Date Obj 2 min read Like