[Chartjs]-Change mysql x-axes date to day in chart.js

1👍

You can convert the date into a day of the week inside your PHP code using DateTime objects:

foreach ($result as $page_row) {
    $page_row['pagedate'] = (new DateTime($page_row['pagedate']))->format('l');
    $data[] = $page_row;
}

0👍

Seems like the issue is within chart.js under chartdata (labels: pagedate).
You could write a separate function to convert the date to its corresponding named day according to this post.

Day Name from Date in JS

Then just change it to labels: myFunction(pagedate)

Leave a comment