Convert a mySQL date to Javascript date

后端 未结 12 1806
没有蜡笔的小新
没有蜡笔的小新 2020-12-25 13:09

What would be the best way to convert a mysql date format date into a javascript Date object?

mySQL date format is \'YYYY-MM-DD\' (ISO Format).

12条回答
  •  再見小時候
    2020-12-25 14:02

    UNIX timestamp (milliseconds since the January 1, 1970) would be my preferred choice.

    You can pass it around as an integer and use the JS setTime() method to make a JS Date object from it.

提交回复
热议问题