Stump the Panel » Site Managers and Site Collection Managers

Time Zone Clocks

(9 posts)
  • Started 4 days ago by SheMilford
  • Latest reply from SheMilford
  1. SheMilford
    Member

    Is there a way to post Time Zone Clocks in SharePoint? My company has offices located around the world and we would like to have a table or banner that displays time zones for like Eastern, Central, Mountain, Pacific, Japan, Korea, Guam, and Diego Garcia, that uses your computer's system clock as its time source. What would be the script for something like that?

    Posted 4 days ago #
  2. tobrien
    Member

    I came across this and thought you might fidn it useful.
    http://8002.freesharepoint2007.com/default.aspx

    Therese

    Posted 4 days ago #
  3. SheMilford
    Member

    It is pretty neat, but we can't advertise on our website. I just need a simple table with maybe the location, time and date.

    Posted 3 days ago #
  4. trev
    Member

    Can't remember where we got the code, but I did the same thing for my company:

    Plunk this in a Content Editor Web Part. Adjust timezones as needed and fancy up the table formatting if you like

    <script type="text/javascript">
    <!--
    function getObj(name) {
         if (document.getElementById)
              return document.getElementById(name);
         else if (document.all)
              return document.all[name];
         else if (document.layers)
              return document.layers[name];
         return false;
    }
    
    // function to calculate local time
    // in a different city
    // given the city's UTC offset
    
    var timer_id = 0;
    
    function updateTimer(timer_id, city, offset) {
         var obj = null;
         if ( !(obj = getObj("timer_" + timer_id)) ) return;
         obj.innerHTML = cityTime(city, offset);
         setTimeout("updateTimer(" + timer_id + ", '"+city+"', '"+offset+"')", 1000);
    }
    
    function cityTime(city, offset) {
    
         // avoid errors in offset values
         offset = parseInt(offset);
    
        // create Date object for current location
        d = new Date();
    
        // convert to msec
        // add local time zone offset
        // get UTC time in msec
        utc = d.getTime() + (d.getTimezoneOffset() * 60000);
    
        // create new Date object for different city
        // using supplied offset
        nd = new Date(utc + (3600000*offset));
    
         // Get simple time in hours, minutes, and AM/PM
         var hours = nd.getHours() % 12 + 1;
         var minutes = nd.getMinutes();
         var seconds = nd.getSeconds();
         var am_pm = (nd.getHours() >= 11) ? "PM" : "AM" ;
    
        // return time as a string
         if (minutes < 10) {
         return "" + hours + ":" + "0" + minutes + " " + am_pm + "";
    	}
        else {
         return "" + hours + ":" + minutes + am_pm + "";
         }
    
       // return "The local time in " + city + " is " + nd.toLocaleString(); // Old return statement
    }
    function calcTime(city, offset) {
         timer_id++;
         setTimeout("updateTimer(" + timer_id + ", '"+city+"', '"+offset+"')", 1000);
         return "<span id=\"timer_"+timer_id+"\">" + cityTime(city,offset) + "</span>";
    }
    //-->
    </script>
    
    <table border="0" cellspacing="0" cellpadding="1">
      <tr>
        <td>Atlantic</td>
        <td><script type="text/javascript">document.write(calcTime('ADT', '-4'));</script></td>
      </tr>
      <tr>
        <td>Eastern</td>
        <td><script type="text/javascript">document.write(calcTime('ADT', '-5'));</script></td>
      </tr>
      <tr>
        <td>Central</td>
        <td><script type="text/javascript">document.write(calcTime('ADT', '-6'));</script></td>
      </tr>
      <tr>
        <td>Mountain</td>
        <td><script type="text/javascript">document.write(calcTime('ADT', '-7'));</script></td>
      </tr>
      <tr>
        <td>Pacific</td>
        <td><script type="text/javascript">document.write(calcTime('ADT', '-8'));</script></td>
      </tr>
    </table>

    .
    .
    .
    Update:

    I believe the code is from this site:
    http://articles.techrepublic.com.com/5100-10878_11-6016329.html

    and modified with help from this forum thread:
    http://www.gimptalk.com/forum/javascript-time-zone-help--t4988s200.html

    Posted 3 days ago #
  5. idosp
    Member

    A variation on the table (instead of stacked):

    <TABLE cellSpacing=3 cellPadding=2 border=0>
    <TBODY>
    <TR>
    <TD>Atlantic</TD>
    <TD>
    <SCRIPT type=text/javascript>document.write(calcTime('ADT', '-4'));</SCRIPT>
    </TD>
    <TD>Mountain</TD>
    <TD>
    <SCRIPT type=text/javascript>document.write(calcTime('ADT', '-7'));</SCRIPT>
    </TD></TR>

    <TR>
    <TD>Eastern</TD>
    <TD>
    <SCRIPT type=text/javascript>document.write(calcTime('ADT', '-5'));</SCRIPT>
    </TD>
    <TD>Pacific</TD>
    <TD>
    <SCRIPT type=text/javascript>document.write(calcTime('ADT', '-8'));</SCRIPT>
    </TD></TR>

    <TR>
    <TD>Central</TD>
    <TD colspan="3">
    <SCRIPT type=text/javascript>document.write(calcTime('ADT', '-6'));</SCRIPT>
    </TD></TR>
    </TBODY></TABLE>

    Posted 3 days ago #
  6. stump
    Member

    have you looked at the Bamboo World Clock And Weather Web Part?

    Posted 2 days ago #
  7. jdem
    Member

    Here's another vote for the Bamboo World Clock and Weather web part. We found it to be easy to install, easy to configure and nice-looking. And, it's free. Worth checking out, anyway. It probably keeps track of who is/is not in daylight-savings time better than the JavaScript, too.

    Posted 2 days ago #
  8. idosp
    Member

    The Bamboo World Clock and Weather web part is probably GREAT -- and better than the above. I'd LOVE to use it!!

    BUT it does require you to "install" it onto the server. If you do not have server access, then you cannot use it.

    What I like about the above is as a Site Owner -- I can add it or not. What I appreciate about the EndUserSharePoint.Com site and this forum is that it provides ways for all of us to improve out sites.

    Posted 2 days ago #
  9. SheMilford
    Member

    Thank you all for the information. I went to the Bamboo World Clock and Weather website (http://store.bamboosolutions.com/pc-55-1-world-clock-and-weather-web-part.aspx), but notice most of the clocks advertised this site. Is that the case when you install this application?

    Posted 1 day ago #

RSS feed for this topic

Reply

You must log in to post.