TAXES

TECHNOLOGY

SERVICES

CRYSTAL COMPUTER CONCEPTS

DELAWARE'S   ·      MIDDLETOWN  ·     ODESSA  ·    TOWNSEND AREA

This illustrates some code for writing javascript date and time functions

The toLocaleTimeString() method returns your current time:

Click the button to display the time as a string.

The method is attached to the instantiated time object: d.toLocaleTimeString()

 
     <script type="text/javascript">
     function setExpDate(formDate){
        // set number of days to add
      var interval = 5;
      var startDate = new Date();
      document.write('start: ' + startDate);
      var expDate = startDate;
      expDate.setDate(startDate.getDate() + interval);
      document.write('<br>expire: ' + expDate);
     }
     </script>
<script type="text/javascript">

<p>Local Date and Time, including GMT difference.  Uses 3 to_string methods.</p>
ourDate = new Date(); //This instantiates the date object.
document.write("The time and date at your computer's location is: 
"+ ourDate.toLocaleString() + ".
"); document.write("The time zone offset between local time and GMT is " + ourDate.getTimezoneOffset() + " minutes.<br/>"); document.write( "<pThe time and date (GMT) is: " + ourDate.toGMTString() + ".</p>"); </script>

The getFullYear() method returns the full year of a date:

Buffalo Run Trophies

Return to Table of Contents


DELAWARE'S MIDDLETOWN ODESSA AND TOWNSEND AREA