NodeJS outputs incorrect Date value in console.log
Assuming:
var todayDate = new Date();
Machine timezone: GMT+0530 / IST
Following are results:
#1
console.log ('Today date:', todayDate);
Output: 020-04-04T09:54:29.107Z
#2
console.log ('Today date as UTC:', todayDate.toUTCString());
Output: Today date as UTC: Sat, 04 Apr 2020 09:54:29 GMT
#3
console.log ('Today date as string:', todayDate.toString());
Output: Today date as string: Sat Apr 04 2020 15:24:29 GMT+0530 (India Standard Time)
I am getting Output#1 whereas expected output is #3.
The Chrome browser shows same result as #3 which I expected with NodeJS since it runs on Chrome engine.
Please explain why NodeJS not output in local date/time.
Sat Apr 04 2020 12:45:57 GMT+0200 (Central European Summer Time)in my case.