0

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 ?

angvee
  • 257
  • 2
  • 16
  • [Moment.JS](http://momentjs.com/), [Format.JS](http://formatjs.io/), custom code, [Date formatting](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString)... – DrakaSAN Sep 29 '16 at 10:08
  • 1
    Possible duplicate of [How to format a JavaScript date](http://stackoverflow.com/questions/3552461/how-to-format-a-javascript-date) – DrakaSAN Sep 29 '16 at 10:09

1 Answers1

0

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"
abdulbarik
  • 6,101
  • 5
  • 38
  • 59