I am working with Highcharts and I am showing information from my database in the following way:
data: [<?php
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo "[Date.UTC(".date('y,m,d', strtotime($row['fecha_emision']))."),".$row['total_dia']."],";
}
}
?>
But the problem is that my script considers the first month as 0. So when my database shows the following date:
[Date.UTC (2016, 06, 6), 14]
Consider this date as July 6 when in fact it should be June 6 .
The solution is as follows:
data: [<?php
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
//RESTAMOS UN MES LA FECHA, PUES JAVASCRIPT CONSIDERA EL PRIMER MES 0;
$fecha_emision=$row['fecha_emision'];
echo "[Date.UTC(".date('y,m,d', strtotime("-1 month", strtotime($fecha_emision)))."),".$row['total_dia']."],";
}
}
?>
]