get system boot time in minutes in javascript

To get system boot time in minutes using Javascript in Node.js, we can make use of the built-in os module which provides various operating system-related utility methods and properties. Specifically, we can use the os.uptime() method which returns the system uptime in seconds.

We can then divide the uptime by 60 to convert it into minutes. Here's an example code snippet to achieve this:

const os = require('os');

const bootTimeMinutes = Math.floor(os.uptime() / 60);

console.log(`System boot time: ${bootTimeMinutes} minutes`);
143 chars
6 lines

In this code, we first import the os module using the require() method. Then, we calculate the system uptime in seconds using the os.uptime() method and divide it by 60 using the Math.floor() function to get the uptime in minutes. Finally, we log the boot time to the console using template literals.

gistlibby LogSnag