format date using javascript

后端 未结 3 1278
小鲜肉
小鲜肉 2021-01-26 15:44

have problem for format date in JavaScript, this is my function code

   //originalDate = \'2016-03-02 09:12:14.989522\';
   var d = new Date(originalDate),
             


        
3条回答
  •  醉梦人生
    2021-01-26 16:32

    Is the date parameter in your code a Date object? That won't work. There is no such constructor in Javascript. You could use date.now() though.

    Check here for the valid constructors for Date https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date

提交回复
热议问题