JavaScript New Date Create:- GeniusofStudent


  • A date consists of a year, a month, a day, an hour, a minute, a second, and milliseconds.
  • Using new Date(), creates a new date object with the current date and time.

  • Code:-

  • <!DOCTYPE html> 
  • <html> 
  •  
  • <head> 
  •  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  • </head> 
  •  
  • <body> 
  •  <h1>Get Current Date & Time</h1> 
  •  
  •  <p>new Date() used to get current system time</p> 
  •  
  •  <input type="button" onclick="get_date();" value="System Date & Time"> 
  •  
  •  <div id="d1"></div> 
  •  
  •  <script> 
  •   function get_date() 
  •   { 
  •  
  •    document.getElementById('d1').innerHTML = new Date(); 
  •  
  •   } 
  •  </script> 
  •  
  • </body> 
  •  
  • </html>
  • JavaScript New Date Create:- GeniusofStudent JavaScript New Date Create:- GeniusofStudent Reviewed by Network security on June 09, 2019 Rating: 5

    No comments:

    Useful Information

    Powered by Blogger.