Topic: Another "read time from server" plea for help

Many users have asked for help on reading the time from the server but it seems that this can not be answered easily and satisfactorily.

- I have tried to set UTCTime and offset as suggested in another post by the site administrator. If I set the time at say 12:00:00 and the offset to +3600, the clock starts at 13:00 (correct) and shows the correct time until the page is refreshed. It then starts again from 13:00 because it reads the set UTCTime as 12:00 and adds the one hour offset.

- Trying the php parameter to read the server time, just doesn't display the clock at all.

Any ideas please? I would desperately like to use this clock but want it to show my local time, not the visitor's time. Thanks if somebody is listening.


Re: Another "read time from server" plea for help


Can you paste source code, where you retrieve UTC Time from server?

(by the way we have example how to do it in PHP: http://www.xorbin.com/widgets/analog-fl … /example-5)


Re: Another "read time from server" plea for help

Thanks for replying. I had tried many combinations before quitting and uninstalling the analog clock.

As I understand from your reply, it should be working. I will give it another try within the next day or two because I really like and want to use it. I will use the exact code of the example although I'm sure that this is what I used before.

In any case, I will post back whether it was successful or not.


Re: Another "read time from server" plea for help

As I said earlier, I'm very anxious to install the analog clock, so I started working on a new installation quickly. But... still no luck!

First, let me say that my site is built with Zen Cart, which reads from various .php files and builds the .html code. What I want to do is have the clock in my page footer, common to all pages. I have created a footer menu with the clock on the left part of the footer.

To build the menu, I use a number of <li>...</li> and format it with css. The footer is within the file english.php (a language file) and there is a similar footer within the greek.php file, which displays the same contents in my Greek pages.

The english.php file starts as below:

  define('FOOTER_TEXT_BODY', '

<div id="customfooter">
<div id= "custommenu" class="custommenu">
  <li class="col00 firstcol">

script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript"><!--
    var flashvars = {
        clockSkin: "media/skins/skin004.png",
        arrowSkin: "7",
        showSeconds: "no",
        arrowScale: "70",
        UTCTime: "<?php echo gmdate('H:i:s'); ?>",
        timeOffset: "3600",
        widgetUrl: "http://www.xorbin.com/"
        {scale: "noscale", wmode: "transparent"}
// --></script>

<li class="col00">&nbsp;</li>   
  <li class="col0 coltopper"></li>   
  <li class="col0"><a href="index.php?main_page=index&amp;language=en"><img border="0" src="images/design/home.png" width="24" height="24" alt="Home" title="Home" /></a></li>   
  <li class="col0"><a onClick="window.scrollTo(0,0);"><img border="0" src="images/design/top.png" width="24" height="24" alt="Top of page" title="Top of page" /></a></li>   
  <li class="col1 coltopper">Info</li>
  <li class="col1"><a href="index.php?main_page=about_us&amp;language=en">About Athens Collectibles</a></li>   
  <li class="col1"><a href="index.php?main_page=contactus&amp;language=en">Contact us</a></li>   
  <li class="col1"><a href="index.php?main_page=site_map&amp;language=en">Site map</a></li>   
  <li class="col1"><a href="index.php?main_page=advanced_search&amp;language=en">Advanced search</a></li>   
  <li class="col2 coltopper">Shop</li>
  <li class="col2"><a href="index.php?main_page=products_new&amp;language=en">New products</a></li>   
  <li class="col2"><a href="index.php?main_page=featured_products&amp;language=en">Featured products</a></li>   
  <li class="col2"><a href="index.php?main_page=products_all&amp;language=en">All products</a></li>   
  <li class="col2"><a href="index.php?main_page=art&amp;language=en">Our art gallery</a></li>   
  <li class="col3 coltopper">Policies</li>
  <li class="col3"><a href="index.php?main_page=conditions&amp;language=en">Terms and conditions</a></li>   
  <li class="col3"><a href="index.php?main_page=privacy&amp;language=en">Privacy policy</a></li>   
  <li class="col3"><a href="index.php?main_page=payments&amp;language=en">Payment methods</a></li>   
  <li class="col3"><a href="index.php?main_page=shippinginfo&amp;language=en">Shipping and returns</a></li>   
  <li class="col4 coltopper">Various</li>
  <li class="col4"><a href="index.php?main_page=dvdinfo&amp;language=en">Information about our DVD</a></li>   
  <li class="col4"><a href="index.php?main_page=reward&amp;language=en">Reward Program</a></li>   
  <li class="col4"><a href="index.php?main_page=destinations&amp;language=en">Where we ship</a></li>   
  <li class="col4"><a href="index.php?main_page=unsubscribe&amp;language=en">Unsubscribe from newsletter</a></li>   

........ (some more <div>...</div> content here)


  @setlocale(LC_TIME, 'en_US.ISO_8859-7');
  define('DATE_FORMAT_SHORT', '%d/%m/%Y');  // this is used for strftime()
  define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()
  define('DATE_FORMAT', 'd/m/Y'); // this is used for date()

  if (!function_exists('zen_date_raw')) {
    function zen_date_raw($date, $reverse = false) {
      if ($reverse) {
        return substr($date, 0, 2) . substr($date, 3, 2) . substr($date, 6, 4);
      } else {
        return substr($date, 6, 4) . substr($date, 3, 2) . substr($date, 0, 2);


  define('HTML_PARAMS','dir="ltr" lang="en"');

  define('CHARSET', 'iso-8859-7');

  define('FOOTER_TEXT_REQUESTS_SINCE', 'requests since');

......... (more php content)

You can see the clock code there near the top as copied from the http://www.xorbin.com/widgets/analog-fl … /example-5 page.

This doesn't work and produces a 500 error (very generic "Internal Server Error"). When the UTCTime was removed, it didn't give the 500 error but the clock did not display. So, having transferred the "js" and "media" folders to my root directory, I started investigating the reasons and found out:

1. The skin does not display if it remains within the media/skins folder. It does display if it's moved to my root directory. As the default skin002.png was too large, I edited it with PhotoShop, reduced its size from 144x144 to 75x75 renaming it to clock.png (just to make some sense) and moved it to the root directory. I edited the two parameters from '200' to '75' and changed the path in clockSkin variable to "clock.png".

2. The javascript swfobject.js is not executed if src="swfobject.js" as in line 2 of the example. I changed it to src="js/swfobject.js" and it works.

3. I also changed lines 14 and 19 of the example to read "media/devAnalogClock.swf" and "media/expressInstall.swf" for the same reason, that is I added the media/ to the path.

4. I changed some other variables like arrowSkin, showSeconds and arrowScale but these changes are irrelevant to the clock's functionality.

After all the changes, I ended with the following code:

<p id="devAnalogClock"><a href="http://www.xorbin.com/">Analog flash clock widget</a></p>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript"><!--
    var flashvars = {
        clockSkin: "clock.png",
        arrowSkin: "2",
        showSeconds: "yes",
        arrowScale: "60",
        timeOffset: "3600"
        {scale: "noscale", wmode: "transparent"}
// --></script>

This gives me a nice clock but it displays the visitor's time, not my time as intended. Please note that the timeOffset parameter in the above code does not change anything. The time shown is my computer's time whatever value I give to it (3600, +3600, 10800, +10800) or even when I completely delete the line. This is understandable as there is no base time to calculate the offset.

Every time I insert the UTCTime: "<?php echo gmdate('H:i:s'); ?>", line I get the dreaded 500 error. I have no idea of php and javascript but I tried changing the double quotes at the beginning and end with single quotes, escaped single and double quotes or no quotes. No improvement!

The clock can be seen at the footer of my http://www.athenscollectibles.info/inde … page=index main page. Never mind the misaligned footer contents, I will sort it out with css if the clock finally works.

My server runs PHP 5.2.17 if that makes any difference.

I shall be watching this forum for any ideas or suggestions. Thanks in advance for your assistence.



Re: Another "read time from server" plea for help

Update to my yesterday's post

I found out why the code broke and gave the 500 error: it was not the double quotes of the UTCTime line but the single quotes in gmdate('H:i:s'). I changed it to gmdate(\'H:i:s\') and it now shows the clock but...

...the time is 12:59:57 and stays there. The seconds hand is not moving at all.

I tried the digital flash clock. In that case, the display says 11:11:11 PM and the seconds do not change.

The immovable analog clock is at the footer of page http://athenscollectibles.info and I really don't know what else to try. The code used is:

<object type="application/x-shockwave-flash" data="media/devAnalogClock.swf" width="100" height="100">
    <param name="movie" value="media/devAnalogClock.swf" />
    <param name="scale" value="noscale" />
    <param name="wmode" value="transparent" />
    <param name="flashvars" value="clockSkin=clock.png&arrowSkin=2&arrowScale=60&UTCTime=<?php echo gmdate(\'H:i:s\'); ?>&timeOffset=3600" />
    <p><a href="http://www.devbox.info/">Analog flash clock widget</a></p>

Thanks in advance for any help and kind regards.



Re: Another "read time from server" plea for help

"The persistent wins" said Plutarch, the ancient Greek historian.

I now solved the problem and have the clock in my page footer. As I said from the beginning, I fell in love with this clock and could not accept defeat. So, I spent most of the day reading about php and javascript on the web and:

- added the following to my .htaccess file:

RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html

- created a simple html file:

        <title>Analog clock</title>
        <script type="text/javascript" src="js/swfobject.js"></script>

        <div id="devAnalogClock">
<script type="text/javascript">
            var flashvars = {
                clockSkin: 'clock.png',
                arrowSkin: '2',
                arrowScale: '60',
                UTCTime: '<?php echo gmdate('H:i:s'); ?>',
                timeOffset: '10800'
                {scale: 'noscale', wmode: 'transparent'}


- replaced the previous <object>...</object> script with:

<div id="devAnalogClock"></div>
<object type="text/html" data="clock.html"></object>

- arranged the clock's position with css.

I'm still not 100% confident about what a visitor in another time zone sees but I can make adjustments to the offset variable in the html file if necessary.

I will spent some time tomorrow to tidy up my directories by grouping all clock related files into a folder and delete temporary files created during experimentation and I also have to make the clock appear in the footer of my Greek pages but this is not something difficult. I just don't do it tonight as it's almost midnight now in Greece.

Can I just ask whoever is reading to check the footer of my English page at http://athenscollectibles.info and tell me if they see Athens time displayed. This should be London +2, New York +7, Los Angeles +10, Tokyo -6, Sydney -7 hours and so on. Any feedback will be really, really appreciated.

Thanks in advance for the very nice clock and for any volunteers' help.


Last edited by peroulg (2011-05-16 15:49:15)


Re: Another "read time from server" plea for help


apparently we live in the same time zone, because now its 14:15 in Lithuanian and 14:15 in Greece, but as I look in to you source code http://www.athenscollectibles.info/clock.html it looked OK for me, because i can see that you get local time from your server:

<param name="flashvars" value="clockSkin=clock.png&amp;arrowSkin=2&amp;arrowScale=60&amp;UTCTime=11:17:03&amp;timeOffset=10800">



Re: Another "read time from server" plea for help

Thank you Donatas,

Yes, I checked and we are definitely in the same time zone, but I think the time is displayed correctly now.

Just as I thought that the problem was solved last night, I discovered that the display is horrible on Internet Explorer 8. The image below is self-explanatory!


The footer displays nice with all other browsers like below:


I'm trying to work out a solution, if possible. Unless you can think of something by looking at the images wink