Hai
I have the system with employees having different timezones in their profile. I would like to show the date according to their timezones specified. The GMT time zone values are placed in the database. could you guys help me
Hai
I have the system with employees having different timezones in their profile. I would like to show the date according to their timezones specified. The GMT time zone values are placed in the database. could you guys help me
Check out PHP's timezone-setting functions, including date_timezone_set
.
in addition to Dav's answer i propose to store all time data in "timestamp" mysql datatype because it automatically handles timezones
Let’s say your server is located in the usa and store dates in database with local us gmt -7 So you send the local offset -7 and the offset of the employee country, lets say some where in Europe +2.
So basically you just need to know what is -7 -2 and its 9 hours offset, so each date you have stored in the database must be added 9 hours to represent the time in Europe.
After you count the offset you just need to get the date from the db and add to it the offset. Like that - >
$intUnixTimeStamp += $intGmtOffest*60*60;
So this is the proper way to do it with php. And if you want to query the server based on user selected time you need to go back -9 .