Problem with retrieving mySQL data with DATE column
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have this problem for data table in mySQL DB with column defined using DATE format such as
`InstallDate` date NOT NULL,
Then I use following lines to get the data:
SQLquery = ['SELECT * FROM db_abc']; Table_db_abc = fetch(dbConn, SQLquery);
I got Table_db_abc = [].
Actually, I checked that Table_db_abc is not empty. It shows basic info of the table correct. If I use
SQLquery = ['SELECT COLUMN1 FROM db_abc']; Table_db_abc_Col1 = fetch(dbConn, SQLquery);
Table_db_abc_Col1 will be shown correctly, until the column defined as DATE.
However, if in the SQLquery, I specifically make
"DATE_FORMAT(''%d-%m-%Y'', InstallDate) AS InstallDate"
for that column like
SQLquery = ['SELECT COLUMN1 DATE_FORMAT(''%d-%m-%Y'', InstallDate) AS InstallDate COLUMN0 FROM db_abc'];
Then it works.
So, what is the problem? Someone told me it is matlab's problem with presenting the data of that format. It gets the data. Just not present correctly.
Any thoughts? Thanks...
0 Commenti
Risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!