Reputation: 43
How to get the Exact time and date of the client area, without depending to the local time & date of client's pc. Even if the time and/or date of that pc is set to a wrong time, I want to show the exact time and date of that timezone at my webpage.
May I calculate it using the server time and timezone of client pc and how? Or any other way to do this?
I want any solution with php, mysql, js or jQuery...
Thank you so much...
Upvotes: 1
Views: 633
Reputation: 172309
What you need to do is to guess the clients timezone. You can only make a guess. There are services where you can send the clients IP address to have it guess the geographic location, and from that figure out the timezone. But they are not reliable. The best is if you ask the client what timezone he is in.
You can then use the jstimezonedetect JS library to make a guess and let the user confirm that. Once you then know the clients timezone, you need to convert your servers time to the client time. How to do that is answered here.
Upvotes: 1
Reputation: 46900
If you do it with any server side language like php, it will display server time independent of client's computer. Only client side scripts will display client pc time
like php time()
Upvotes: 1