convert days to seconds

 

Here is the example of convert days to seconds using JavaScript 

Simply one day has 24 hours and one hour has 60 minutes and one minute has 60 seconds, Hence one day = hours * minutes * seconds 

 

 

function days_to_seconds(days = 1) {

  return Math.round(days * 24 * 60 * 60);
}


let days = 3;

let seconds = days_to_seconds(days);


//print seconds 
console.log(seconds);

Tags:

Share:

Related posts