문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top