----- Original Message ----- 
From: "Chris Shiflett" <[EMAIL PROTECTED]>
To: "Jake McHenry" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, October 28, 2003 2:14 PM
Subject: Re: [PHP] OT - Quick JavaScript Question


> --- Jake McHenry <[EMAIL PROTECTED]> wrote:
> > I know this is a bit off topic, but does anyone know of a way I can
> > take the server time in php and get it into javascript?
>
> Well, that part isn't off-topic, in my opinion.
>
> JavaScript and HTML are the exact same thing from the perspective of PHP;
> they're output. So yes, you can get any information from PHP to JavaScript
by
> writing it:
>
> <script language="javascript">
> ...
> <?
> $ts = time();
> echo "var ts = $ts;\n";
> ?>
> ...
> </script>
>
> My JavaScript syntax might be wrong, but hopefully you get the idea.
>
> Chris
>
> =====
> My Blog
>      http://shiflett.org/
> HTTP Developer's Handbook
>      http://httphandbook.org/
> RAMP Training Courses
>      http://www.nyphp.org/ramp
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

I have tried this already, and it works, the JavaScript get's the server's
time, but then the JavaScript clock doesn't keep counting, it's stuck at the
servers time. It needs that Date() function to keep pulling the time from
the local machine I guess. I was wondering if anyone knew of a way I could
pass the server time into the JavaScript Date() function to make it start
counting from that time, instead of the users machine time.

Thanks,
Jake

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to