I am displaying 50 concert details on a page, which come from an online JSON source.
The date is in JSON format and I want to convert and display it in the normal format.
I was going down the route of acquiring by class name, converting and then appending; but I have hit a bit of a wall.
eventTimeConv is empty as I was going to append my converted date into there:
<div class = "eventTimeConv"></div>
<div id = "event-time" class = "event-date-time">{{ show.datetime }}</div>
The javascript I have written up so far:
function changeDate()
{
var date = document.getElementsByClassName("event-date-time");
var newDate = new Date(date);
var dateConverted = newDate.toDateString();
var div = document.getElementsByClassName("eventTimeConv");
}
The conversion to dateConverted fails due to 'date' being a collection I'm assuming.
Can anyone provide some guidance here? Or an alternate method?