It's not so simple with server and local times... Even for the developers of the site (in central European summer time zone, JunkMale wrote Today at 10:22 AM after Savvykms which wrote Today at 12:05 AM ???)
Then the difference is given by :
echo "var diff = new Date(".$d['year'].", ".[COLOR="Red"]($d['mon']-1)[/COLOR].", ".$d['mday'].", ".$d['hours'].", ".$d['minutes'].", ".$d['seconds'].", 0).getTime() - [COLOR="Red"]new Date().getTime();[/COLOR]\n";
After this changes, a difference less than 6 hours (time zone difference with Atlanta, Georgia, US - Eastern Daylight Time) suggests that the server or the local machine aren't on time (8 seconds) but (with or without milliseconds) gives no indication of the transmission time...
EDIT : How can I wrote at 04:22 PM ???
YOU DO NOT ACCOUNT FOR DAY LIGHT SAVINGS.... This is something done on the local users machine. As soon as you start messing about with calculations on time deferences, you will find your code is introducing an additional 1 hour or missing an extra hour. If you use UTC time, this overcomes the problem. GMT is the standard by which ALL clocks in the world are set, even in the USA.
Besides, a call to Microsoft technical help desk several years ago resolved this little chestnut.
Getting the server time isn't as difficult as people are making out and you don't even need to use PHP at all to achieve this goal. One word... AJAX.
A simple header request will return a header with a server time stamp which should be a UTC time stamp even though most will return GMT as in the same time as UTC time which when your in day light savings will be adrift by 1 hour which means a simple GMT & UTC time check will let you know if DLS are in effect on the local machine as not all countries observe DLS.
The easiest document to get a header from via ajax is the current document.location which you get the response header for the "Date" and you will be returned a string which will look like Tuesday, 31 February 2011 09:06:27 GMT and extracting the raw information would be as simple as issuing a "split" at spaces, pop the last two elements off and keep the result of the 2nd "pop" or slice it out by finding the last space in the string and chopping it 8 character prior to the last space in the string would grab the time.
Either way, you will have to do some coding. The AJAX method IMHO is a good system for servers and websites with no access to things like server sides.
Also.... STOP USING setTimeout, its setInterval for all timing events that repeat at a set interval, like clocks...It only needs setting once and it will run for the duration the browser window is open... Therefore setTimeout("TimeCount()", 1000); can be deleted from the function and a clock = setInterval("TimeCount()",1000) placed outside that function will call that function every second until it is killed with a clearInterval(clock) call on the object that its bound to.