Guest User

Untitled

a guest
Aug 13th, 2019
61
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var decimalTimeString = "3,91201611110591";
  2. var decimalTime = parseFloat(decimalTimeString);
  3. decimalTime = decimalTime * 60 * 60;
  4. var hours = Math.floor((decimalTime / (60 * 60)));
  5. decimalTime = decimalTime - (hours * 60 * 60);
  6. var minutes = Math.floor((decimalTime / 60));
  7. decimalTime = decimalTime - (minutes * 60);
  8. var seconds = Math.round(decimalTime);
  9. if(hours < 10)
  10. {
  11. hours = "0" + hours;
  12. }
  13. if(minutes < 10)
  14. {
  15. minutes = "0" + minutes;
  16. }
  17. if(seconds < 10)
  18. {
  19. seconds = "0" + seconds;
  20. }
  21. alert("" + hours + ":" + minutes + ":" + seconds);
  22.  
  23. var decimalTimeString = "3,91201611110591";
  24. var n = new Date(0,0);
  25. n.setSeconds(+decimalTimeString * 60 * 60);
  26. alert(n.toTimeString().slice(0, 8));
RAW Paste Data