tags:

views:

33

answers:

2

I would like to find real time in some region in order to send it to the database. I tried to do something like this:

date_default_timezone_set('Asia/Jerusalem');
$date = date('Y-m-d H-i-s');

But when user changes the time on his computer it is sent to DB like he set it. So I want to get the real zone time - not from user's computer. Is it possible? If yes - how?

A: 

The time that a user sets on their system cannot impact PHP's date() function because the date() function executes on the server, not the user's system.

The most reliable way to determine the user's local time based on their timezone without their direct input would be to get it based on their IP address.

Use GeoIP from MaxMind to get the latitude/longitude, then use geonames.org to get the timezone from the latitude/longitude.

Fo
A: 

You could try using date_timestamp_get, as this function is part of the same class in its OOP version.

XLR3204S