Advertisement
Guest User

Data Time updated

a guest
Apr 20th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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>
  10.     <script>
  11.             var now = new Date();
  12.             var hours = now.getHours();
  13.             var minutes = now.getMinutes();
  14.  
  15.             var name = prompt("What is your name?");
  16.  
  17.  
  18.             if(hours < 12) {
  19.                 if(hours<6) {
  20.                     document.write("<h1>Good Night ")
  21.                 }
  22.                 if(hours >=6) {
  23.                     document.write("<h1>Good Morning  ");
  24.                 }
  25.                
  26.             }
  27.  
  28.             if(hours >= 12) {
  29.                 hours = hours - 12;
  30.                 if(hours < 6) {
  31.                     document.write("<h1>Good Afternoon  ");
  32.                 }
  33.                 if(hours>=6) {
  34.                     document.write("<span><h1>Good Evening ")
  35.                 }
  36.             }
  37.  
  38.             document.write(name + ", It is " + hours + ":" + minutes + " now");
  39.     </script>
  40. </body>
  41. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement