Advertisement
Liliana797979

time

Jan 17th, 2021
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function time(input){
  2.  
  3.     let hour = Number(input[0]);
  4.     let minute = Number(input[1]);
  5.  
  6.     let minutes = hour * 60;
  7.     let totalMinutes = minutes + minute +15;
  8.     let hours = Math.floor(totalMinutes / 60);
  9.     let minutess = totalMinutes % 60;
  10.     if (hours == 24){
  11.         hours = 0
  12.     };
  13.     if(hours <= 23 && minutess < 10){
  14.         console.log(`${hours}:0${minutess}`);
  15.     }else{
  16.         console.log(`${hours}:${minutess}`)
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement