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
https://forums.phpfreaks.com/topic/220458-unique-time/
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
https://forums.phpfreaks.com/topic/220458-unique-time/#findComment-1142351
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
https://forums.phpfreaks.com/topic/220458-unique-time/#findComment-1142353
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.