How to get the system uptime in seconds with Node.js

2 Answers

0 votes
const os = require('os');

console.log(os.uptime());
  
  
       
/*
run:
     
2190410
   
*/

 



answered Mar 10, 2020 by avibootz
0 votes
const os = require('os');

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

console.log(hours);
  
  
       
/*
run:
     
608
   
*/

 



answered Mar 10, 2020 by avibootz

Related questions

...