yusijs
yusijs

Reputation: 867

Nodejs MySQL datetime formatting

So I have a bit of a weird issue. As far as I know, node-mysql should format datetime to javascript date objects. However, it's not.

This is the column: mysql> select order_time from jobs;

+---------------------+
| order_time          |
+---------------------+
| 2016-05-20 16:18:35 |
| 2016-05-20 16:24:47 |

The returned value looks like this:

2016-05-20T14:18:35.000Z

But it should look like this:

Fri May 20 2016 14:18:35 GMT+0200 (Central Europe Daylight Time)

Any ideas on why it gets misformatted?

Upvotes: 3

Views: 9076

Answers (1)

yusijs
yusijs

Reputation: 867

For anyone else struggling with this:

https://github.com/felixge/node-mysql/issues/1423

Basically date objects are changed in node v6+, and will always display as an isoString.

Upvotes: 7

Related Questions