Search code examples
javascriptnode.jsdatetimenodesdatetime-format

Date format in Node


I just want to help with the print date like below.

Thu Sep 06 2018 18:18:26 GMT+0530

I used

console.log(new Date())

but Output of that is

2018-09-06T12:48:25.776Z

So, I don't know how to convert it.


Solution

  • The problem is solved.

    new Date().toString();
    

    This line will convert

    "2019-02-24T20:11:15.213Z"  =>  "Mon Feb 25 2019 01:38:50 GMT+0530 (India Standard Time)"
    

    Thank you guys for spent the time on my question.