Question

I am using the IP2Location Database to get a users timezone but have encountered an issue. When I get the users timezone, it returns this: -05:00. I have no idea what that timezone is and want to know how to convert it into a normal readable time such as: 11:00PM with PHP.

Was it helpful?

Solution

Timezones are just telling you the timezome in which the user is, not the actual current time. The service appears to use normal GTM timezones, so you could see more information for it for example from wiki: http://wwp.greenwichmeantime.com/info/timezone.htm

Then, when logging something you propably would know your own current time in the server, and you could also check the timezone for it. And then simply calculate how many hours difference (note that some timezones are actually only 30 minutes off from the next) is to yours, and use that to calculate the users local time value.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top