Author Topic: is there a way find out time from client computer?  (Read 5349 times)

0 Members and 1 Guest are viewing this topic.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
is there a way find out time from client computer?
« on: January 05, 2003, 05:46:23 PM »
I'm trying add some text that changes every specific pereoud of time and deppence on what hour it is.
if I use time() from php it will uses only server's time. and people visiting from other side of the world would get same thing that from other side...
right now I managed uses javascript to find a time, because it's client side script, but the script become very big, because I need send to client all text for each hour, and javascript shows only the one that is set for the curent time....
so, if atleast that could be acomplished:
in javascript first find what time it is:
DAY = new Date()
HR = day.getHours()
then execute some php code:
{time} or <?php include("time.php"); ?> that will display the text deppense on what is in " HR ".
so, I was wondering if there is a way php can find out what is curent time on client machine?
thx.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
is there a way find out time from client computer?
« Reply #1 on: January 05, 2003, 08:05:34 PM »
No, because PHP is a server-side scripting language and JavaScript a client-side language. When the JavaScript is executed on the client browser the PHP code is already executed before sending the results to the browser.

Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
is there a way find out time from client computer?
« Reply #2 on: January 05, 2003, 08:51:51 PM »
ah, IC, then I guess I'll stick what I got... :)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)