date format in node.JS

前端 未结 5 1949
一个人的身影
一个人的身影 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:41

    Here is the solution :

    var datetme = new Date().toLocaleString();
    

    OR

    const DATE_FORMATER = require( 'dateformat' );
    var datetme = DATE_FORMATER( new Date(), "yyyy-mm-dd HH:MM:ss" );
    

提交回复
热议问题