JavaScript

  1. Home
  2. Computing & Technology
  3. JavaScript

Displaying Author Local Time

2. Get the Script

Join the Discussion

Questions? Comments?

The first step in using this script is to select the code from the text box below (there is a highlight all button beneath it to make this easier) and copy it into a file called mytime.js.

You next attach the script into your web page that you wish to display your timezone information on by adding the following code into the head section of your page.

<script type="text/javascript" src="mytime.js">
</script>

You also need to add the following code (exactly as shown) into the body section where you want your location and local time to be displayed.

<script type="text/javascript">
myTime()
</script>

The next step is to Configure the Script to work with your local timezone.

Introduction | Get the Script | Configure the Script | Daylight Saving

Note that the script and the descriptions of the functions that it contains are rewritten from the "Ask Felgall" website with the permission of the copyright owner.

Explore JavaScript

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

JavaScript

  1. Home
  2. Computing & Technology
  3. JavaScript

©2009 About.com, a part of The New York Times Company.

All rights reserved.