Chartjs-How to get certain text from json object value

1👍

You can split the string using "2020-03-23T14:00:00.000Z".split("T")[0] to get the date without the time.

To replace - characters with /, use the str.replace(searchvalue, newvalue) method. For example:
"2020-03-23".replace(/-/g, "/")

Edit:

for (const dataobj of json) {
      let tempsymbolsDate = dataobj.timestamp.split("T")[0];
      tempsymbolsDate = tempsymbolsDate.replace(/-/g, "/"); 
      console.log(tempsymbolsDate);
    }

Edit 2:

for (const dataobj of json) {
      let tempsymbolsDate = dataobj.timestamp.split("T")[0];
      tempArray = tempsymbolsDate.split("-");
      tempsymbolsDate = tempArray[2] + "/" + tempArray[1] + "/" + tempArray[0];
      console.log(tempsymbolsDate);
    }

Leave a comment