0

I am looking to create a web part that displays the current time in different areas around the world (preset) preferably adjusting to day light savings time. Ive looked at a couple webparts and they are all in a different format to the one I am looking for.

Format :

--------------------------------------------------------------------------------------    
   London - Mon 8:10AM      Hong Kong - Mon 2:10PM     New York - Mon 2:10AM   
--------------------------------------------------------------------------------------

I am trying to include this above or below a site banner as a seperate web part.Would it be possible to pull the time from a site like timeanddate.com or similiar?

Any help in either modifying an existing web part or creating a new webpart would be very much appreciated.

  • I have created world clocks in SharePoint before. I had to use an ASMX web service with JQuery to get the different time zones and daylight savings time differences. Look into web services. – lazoDev Jul 22 '14 at 17:10
  • @lazoDev Thank You! – user3845582 Jul 22 '14 at 17:20
2

I created a world clock in SharePoint using Javascript with the Moment and Moment Timezone libraries. The benefit to this approach is that you don't need to call an external service. The downside is that it relies upon the time on the client. I wasn't building an atomic clock so it was suitable for my needs.

Here is an example that targets a DIV with the ID currentTime. In my implementation, the visitors clicks on a link to see the time in that region. The variable currentRegion matches a Moment Timezone Zone object and can be changed by clicking on a link (that code is not included).

$(document).ready(function () {
    setInterval(showTime, 1000);
});

function showTime() {
    var cT = moment().tz(currentRegion).format('MMMM Do YYYY, h:mm:ss A');
    $('#currentTime').text("Current Time: " + cT);
}
0

You can find a solution for your case here : http://sharepointhero.wordpress.com/2014/07/20/adding-world-clock-and-exchange-rates-web-parts-to-sharepoint/

  • 1
    Can you add some context about your link? Link only answers can be troublesome if the link breaks. – wjervis Jul 24 '14 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.