nodejs console.log timestampt
Sure! Here's a response:
You can use the following code to log a timestamp in Node.js using console.log:
console.log(new Date().toISOString());
Here's an explanation of each step:
1. new Date()
creates a new Date object representing the current date and time.
2. .toISOString()
converts the date to a string in the ISO 8601 format, including the time and time zone.
3. console.log()
outputs the resulting timestamp to the console.