date format in node.JS

前端 未结 5 1941
一个人的身影
一个人的身影 2021-02-01 21:22

I am using mysql database,in that i have a field by name request_date. The type of the field is time stamp and the data stored in this field has the format 20

5条回答
  •  孤城傲影
    2021-02-01 21:23

    I was having the same problem, this fixed my problem:

    You need to 'force' your mysql connection to format it immediately, add this into your config(connection details):

    host: 'localhost',
    user: 'root'
    // ....
    dateStrings: 'date'
    

    Note that in many cases

    dateStrings: true
    

    rather than 'date'

    seems to be the needed solution.

提交回复
热议问题