Advertisement
PadmaJS

Untitled

Jul 18th, 2020
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. function showTime(){
  2. var date = new Date();
  3. var h = date.getHours();
  4. var m = date.getMinutes();
  5. var s = date.getSeconds();
  6. var time1 = h + m + s;
  7. if (h < 10) {
  8. h = "0" + h
  9. }
  10. if (m < 10) {
  11. m = "0" + m
  12. }
  13. if (s < 10) {
  14. s = "0" + s
  15. }
  16.  
  17. var time2 = h + ":" + m + ":" + s ;
  18. document.getElementById("realTime").innerText = time2;
  19.  
  20. }
  21.  
  22. setInterval(showTime, 1000);
  23.  
  24. var alrm_h = document.getElementById("hours").value;
  25. var alrm_m = document.getElementById("minutes").value;
  26. var alrm_s = document.getElementById("seconds").value;
  27. var alarmTime = alrm_h + alrm_m + alrm_s;
  28.  
  29. if (alarmTime == time1) {
  30. console.log("wake up")
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement