phpmysqlsimpledateformatjqwidget

Mysql DATE field selected in format yyyy-MM-ddTHH:mm:ss-HH:mm


I'm using JqxCharts from JqWidgets.

Using a PHP file to get Json data for the Graph.

In Mysql query I do something like this:

SELECT fecha, Qty
FROM somedatabase

2016-05-01     5
2016-07-21     55
2016-08-16     33

The "fecha" field is simple DATE format. But when it display in the graph I always get a wrong date (1 day less)

Apparently it has to do something with Date Format conversion from javascript.

And I need to get the date from MySql in format "yyyy-MM-ddTHH:mm:ss-HH:mm"

How can I get this format from my actual Query?

UPDATE: SOLVED.

Thanks to "tadman", to help me to understand. I searched how to select Mysql ISO 8601, so I found

So now I just updated the Query to:

SELECT DATE_FORMAT(fecha, '%Y-%m-%dT%T-06:00'), Qty
FROM somedatabase

By the way if someone is looking for this, the "T-06:00" is the UTC for Mexico.


Solution

  • Thanks to "tadman", to help me to understand. I searched how to select Mysql ISO 8601, so I found

    So now I just updated the Query to:

    SELECT DATE_FORMAT(fecha, '%Y-%m-%dT%T-06:00'), Qty
    FROM somedatabase
    

    By the way if someone is looking for this, the "T-06:00" is the UTC for Mexico.