Determining user time and date in PHP

I want to have time for a person using a PHP script.

I don’t know what time zone they will be in, etc.

Is there no way to just say "get user time" and not set time intervals?

+5
source share
3 answers

No. There are only three ways to get the user's time zone:

  • Ask user

  • Use JavaScript to check the time on the client side and send it to the server using an AJAX request, cookie, etc. - works only if JS is turned on and the work for the first request does not work

  • IP-to-location, - 5% ,

+7

, . , "" - , HTTP, " ."

Javascript, , .

, .

, .

+5

, php script.

-. , PHP script, , , . Firefox , .

The answer here is to use Javascript to get local time and either do what needs to be done on the client side or send it to the server in some way - but that is another question.

+1
source

All Articles