View Full Version : Local time doesn't shift timezone

11-07-2006, 05:04 AM
1) Script Title: Local Time script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex6/localtime.htm

3) Describe problem:
I cannot seem to get the script to work at all in Firefox, and in Safari it doesn't display the shifted timezones.

I've copied the code almost verbatim from DD. See it in action here:

Prints in Safari:
All of them show the same time, despite having different variables.

Prints in Firefox:
Server Time: NaN:NaN:NaN AM (undefined)


11-07-2006, 08:30 AM
I see two problems here. Firstly, the script in the HEAD section of your page do not match the original version in some lines. Not sure why, but just recopy the script to your page to fix that issue.

Secondly, are you sure your page is properly configured to run PHP? Does this line of code below when added to your page displays the current server time:

<? print date("F d, Y H:i:s", time())?>

11-07-2006, 08:48 AM
PHP should start with <?php .......... ?>, not <?...

That might be valid too. Not sure...

11-07-2006, 10:35 AM
It shouldn't make a difference on most servers, no.

11-07-2006, 10:42 AM
Alright. Wasn't sure.

11-07-2006, 08:30 PM
PHP should start with <?php .......... ?>, not <?...

It shouldn't make a difference on most servers, no.

He's still right though: it should start "<?php". That is always correct and always parsed properly. The shorter forms - <?, <?=, <% - only work if the server is configured to allow them, and the recommended PHP configuration disables them.


11-22-2006, 04:13 PM
same problems here... i copied the code without making any changes ang i get NaN.

btw, i use ie to browse and wamp5.