date format in node.JS

前端 未结 5 1997
一个人的身影
一个人的身影 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-01 21:31

    What you see, is simply the default javascript date formatting. If you want it formatted differently, you can use the methods:

    getDate(): Returns the date
    getMonth(): Returns the month
    getFullYear(): Returns the year
    

    on the date object, and combine the results with / or - or : to get the format you want.

    Have a look at: http://www.elated.com/articles/working-with-dates/ for more details

提交回复
热议问题