angvee angvee - 2 months ago 6
MySQL Question

how to convert timestamp result in node js

I have execute query for get TimeStamp data from MYSQL with Node JS and the result is :

MyDate: Thu Apr 28 2016 07:02:45 GMT+0700 (SE Asia Standard Time)


How to convert that to be 2016-07-28 07:02:45 ?

Answer

See the moment format

moment('Thu Apr 28 2016 07:02:45 GMT+0700 (SE Asia Standard Time)').format("YYYY-MM-Do h:mm:ss");
//"2016-04-28 5:32:45"