1  <HTML>
  2  <HEAD>
  3  
  4  <TITLE>JavaScript Example:  Date object</TITLE>
  5  
  6  <SCRIPT LANGUAGE="JavaScript">
  7  <!--
  8  
  9  function daysUntilYear2000() {
 10    var today = new Date();
 11    var IPOdate = new Date( "Jan 1, 2000" );
 12    var msPerDay = 24 * 60 * 60 * 1000;
 13    var daysLeft = ( IPOdate.getTime() - today.getTime() ) / msPerDay;
 14    daysLeft = Math.round( daysLeft );
 15    return daysLeft;
 16  }
 17  
 18  // -->
 19  </SCRIPT>
 20  
 21  </HEAD>
 22  
 23  <BODY BGCOLOR="#FFFFFF">
 24  
 25  <SCRIPT LANGUAGE="JavaScript">
 26  <!--
 27  
 28  document.writeln( "Today's date is ", new Date(), "<P>" );
 29  document.write( "There are ", daysUntilYear2000() );
 30  document.writeln( " days left until the year 2000!" );
 31  
 32  // -->
 33  </SCRIPT>
 34  
 35  </BODY>
 36  </HTML>
 37  
 38