Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery display time for specific location
    primarykey
    data
    text
    <p>Using the code below I'm able to successfully display the local time on a site. I am using this on a site built on Zurb Foundation 3 - I would like to avoid loading additional plugins. </p> <p>a) How do I make this always display the time in Sydney, rather than the time at the user's end? <strong>Is there a way to do this using the code below and not an entirely different script?</strong></p> <p>b)Plus, if it's an easy fix, how can I make it display which day of the week it is?</p> <pre><code> function updateClock ( ) </code></pre> <p>    </p> <pre><code>{ var currentTime = new Date ( );     var currentHours = currentTime.getHours ( );     var currentMinutes = currentTime.getMinutes ( );     var currentSeconds = currentTime.getSeconds ( );     // Pad the minutes and seconds with leading zeros, if required     currentMinutes = ( currentMinutes &lt; 10 ? "0" : "" ) + currentMinutes;     currentSeconds = ( currentSeconds &lt; 10 ? "0" : "" ) + currentSeconds;     // Choose either "AM" or "PM" as appropriate     var timeOfDay = ( currentHours &lt; 12 ) ? "AM" : "PM";     // Convert the hours component to 12-hour format if needed     currentHours = ( currentHours &gt; 12 ) ? currentHours - 12 : currentHours;     // Convert an hours component of "0" to "12"     currentHours = ( currentHours == 0 ) ? 12 : currentHours;     // Compose the string for display     var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;     $("#clock").html(currentTimeString); } $(document).ready(function() {setInterval('updateClock()', 1000); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload