1. Tech

Your suggestion is on its way!

An email with a link to:


was emailed to:

Thanks for sharing About.com with others!

Improved Author Local Time

3. Configure the Script

Join the Discussion

Questions? Comments?

More of this Feature

Introduction Get the Script

The script that displays the time actually runs on your visitor's computer and relys on their having their timezone and local time set correctly in order to calculate what the time is at your location.

You will need to update a number of fields at the top of the script to refer to your location and timezone and if your location uses daylight saving time you will need to update one line of the script twice a year to convert your time to and from daylight saving time. I have not attempted to automate this as some countries vary their start and end dates from year to year.

  • dst indicates whether you are on daylight savings time or not, update this to 1 when you are on daylight saving time and back to 0 when daylight saving time ends.
  • loc is the name of the place where you are located. (In my case 'Sydney, Australia')
  • mtz is your local time zone relative to Universal Coordinated Time (which was previously called Greenwich mean Time). This is the number of hours ahead of UTC that your local time is so if local time is behind UTC then the value should be negative. (In my case this is set to 10 because Sydney is 10 hours ahead)
  • stdz is your local identifier for standard time. (in my case 'AEST')
  • dayz is your local identifier for daylight savings time. (in my case 'ADST')
  • showDate is a new field not found in the earlier version of this script. It can have any of three values - 0 indicates that no date is to be displayed after the time and day, 1 indicates that the date is to display in the international format where the day precedes the month, 2 indicates that the date is to be displayed in the US format where the month precedes the day.

The remainder of the script obtains the current UTC time and day using the current time and timezone from the visitor's computer and then adjusts it for the timezone that you have specified in order to display the time at your location.

The script works fine as is if you live somewhere that doesn't use daylight saving time (you can just set dst to zero and ignore dayz in that case). The script as written requires manual adjustment twice a year if you have daylight saving in order to update the dst value as you go on and off of daylight saving time.

You can (if you wish) add extra code to set the value for dst automatically. If you are upgrading from my earlier script then you can copy your daylight savings code across unchanged otherwise you will want to reat the instructions that I wrote for that version on how to adjust the dst flag based on the dates that Daylight Saving Time starts and finishes.

Introduction | Get the Script | Configure the Script
See More About

©2016 About.com. All rights reserved.