Jump to content

Unique Time


Thauwa

Recommended Posts

Hey guys. I need to know how to get a time that is constant. What I want to achieve:

I need to make a clock on my website showing only one time (HH:MM:SS), wherever the page is requested from.

And I need to use this "time" in calculations, like finding the time difference between two time values stored in my MYSQL Databases.

I hope that I am clear with my question.

Thanks for any help in advance!  :D

Link to comment
Share on other sites

PHP only has the capability to get the time local to the server. The only time you can get a User's time is if they specifically set what timezone they are in on your website and you do the calculation that way, by analyzing their IP address for timezone information, or by using JavaScript to get the time and passing that to a PHP file.

Link to comment
Share on other sites

The time local to the server, sweeb. And thanks ron_ron, but I think that your code gives the time local to the user. :/ . Do correct me if I am wrong here.

 

time() gives the server time and all date/time functions use the server time and timezone unless you supply alternate ones.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.