How to convert JSON results into a date using JavaScript ? Last Updated : 23 Jan, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report The task is to convert a JSON result to JavaScript Date with the help of JavaScript. There are two methods which are discussed below: Approach 1: Use substr() method to get the integer part of the string.Use the parseInt() method followed by Date() to get the JavaScript date. Example: This example implements the above approach. html <h1 style="color:green;"> GeeksforGeeks </h1> <p id="GFG_UP"> </p> <button onclick="gfg_Run()"> click here </button> <p id="GFG_DOWN"> </p> <script> var el_up = document.getElementById("GFG_UP"); var el_down = document.getElementById("GFG_DOWN"); var jsonDate = '/Date(1559083200000)/'; el_up.innerHTML = "Click on the button to convert" + " JSON result to JavaScript Date." + "<br>JSON Date - " + jsonDate; function gfg_Run() { var date = new Date(parseInt(jsonDate.substr(6))); el_down.innerHTML = date; } </script> Output: How to convert JSON results into a date using JavaScript ? Approach 2: Use the regExp to get the integer part of the string.Use the Date() method to get the JavaScript date. Example: This example implements the above approach. html <h1 style="color:green;"> GeeksforGeeks </h1> <p id="GFG_UP"> </p> <button onclick="gfg_Run()"> click here </button> <p id="GFG_DOWN"> </p> <script> var el_up = document.getElementById("GFG_UP"); var el_down = document.getElementById("GFG_DOWN"); var jsonDate = '/Date(1559083200000)/'; el_up.innerHTML = "Click on the button to convert" + " JSON result to JavaScript Date." + "<br>JSON Date - " + jsonDate; function gfg_Run() { var date = new Date(jsonDate.match(/\d+/)[0] * 1); el_down.innerHTML = date; } </script> Output: How to convert JSON results into a date using JavaScript ? Comment More infoAdvertise with us Next Article How to convert JSON results into a date using JavaScript ? P PranchalKatiyar Follow Improve Article Tags : JavaScript Web Technologies JSON JavaScript-Questions Similar Reads Convert string into date using JavaScript In this article, we will convert a string into a date using JavaScript. A string must follow the pattern so that it can be converted into a date. A string can be converted into a date in JavaScript through the following ways: Table of Content Using JavaScript Date() constructorUsing JavaScript toDat 3 min read How to convert a JavaScript date to UTC? Javascript date can be converted to UTC by using functions present in the Javascript Date object. The toUTCString() method is used to convert a Date object into a string, according to universal time. The toGMTString() returns a string that represents the Date based on the GMT (UT) time zone. By defa 1 min read How to convert UTC date time into local date time using JavaScript ? 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 1 min read How to Convert JSON to string in JavaScript ? In this article, we are going to learn the conversion of JSON to string in JavaScript. Converting JSON to a string in JavaScript means serializing a JavaScript object or data structure represented in JSON format into a textual JSON string for data storage or transmission.Several methods can be used 3 min read How to Convert Date to Another Timezone in JavaScript? Converting a date to another timezone in JavaScript means adjusting the local date and time to match the time in a different timezone. This ensures that the displayed time aligns with the selected timezone, often using built-in methods or external libraries.1. Using Intl.DateTimeFormat() and format( 2 min read Like