Tuesday 11 April 2017

Node js using wrong format on dates

I created a page using handlebars where users can input a date, I works correctly and it shows the correct format on my mysql database, like this: 2017-04-01.

But when I get the date form the database using node js:

connection.query('SELECT date FROM tbl', function(err, rows, fields){
    console.log(rows);
});

I get this output:

Sat Apr 01 2017 00:00:00 GMT+0800 (China Standard Time)

Why does it include the time? but on the database is just the date. This is a problem for me because I need the date to output on a page an it takes too much space.



via Storm Asdg

No comments:

Post a Comment