Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>Document</title>
  8. </head>
  9. <body style="font-size: 65px; text-align:center; vertical-align: middle;">
  10. <div id="block" style="height:100%;">
  11. Прошло уже
  12. </div>
  13. <div id="time"></div>
  14. <div>без Джерки…</div>
  15. <div>
  16. <img src="https://megumin.top/assets/images/src/8e32a8961f3833b107f53df2b6f7dc2ead3de0f0.jpg">
  17. </div>
  18.  
  19. <script>
  20. const content = document.querySelector("#time");
  21. const timer = setInterval(() => {
  22. let date, start, passed, dateString;
  23.  
  24. date = new Date();
  25. start = new Date("2019-06-15T21:16:00");
  26.  
  27. passed = {
  28. years: (start.getFullYear() - date.getFullYear()),
  29. months: ((date.getMonth() + 1) - (start.getMonth() + 1)),
  30. days: (start.getDate() - date.getDate()),
  31. hours: (start.getHours() - date.getHours()),
  32. minutes: (start.getMinutes() - date.getMinutes()),
  33. seconds: (date.getSeconds() - start.getSeconds())
  34. };
  35.  
  36. dateString = `${passed.years} лет ${passed.months} мес ${passed.days} дней ${passed.hours} часов ${passed.minutes} минут ${passed.seconds} секунд`;
  37. content.innerText = dateString;
  38. }, 1000);
  39. </script>
  40. </body>
  41. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement