hitk Posted July 8, 2010 Share Posted July 8, 2010 I need to know what should I do to show event time (stored in mysql) according viewer's local time. I have stored time in two format (one simple 12:30; and another in timestamp format). The timings are of future and stored as GMT. Now, I would like to show time of event according to the viewer's location. Suppose Visitor is from India than Time should be in IST (GMT + 05:30 Hours). How its possible ? Quote Link to comment https://forums.phpfreaks.com/topic/207099-event-time-according-local-visitor-time/ Share on other sites More sharing options...
hitk Posted July 8, 2010 Author Share Posted July 8, 2010 Ok. Seems to be problem similar to http://www.webmasterworld.com/php/3398104.htm But I have no idea how to fetch data from mysql and convert it. Moreover, something javascript was use. No idea whether it work in my custom script. Edit : I might be wrong, what I am telling. It should be like this - http://www.cricinfo.com/england-v-australia-2010/content/series/426337.html?template=fixtures What I see is like below. When you see the url, it will time according to your ip (or zone no idea) Quote Link to comment https://forums.phpfreaks.com/topic/207099-event-time-according-local-visitor-time/#findComment-1082865 Share on other sites More sharing options...
Pikachu2000 Posted July 8, 2010 Share Posted July 8, 2010 Have a look at the mysql CONVERT_TZ function. I would guess it to be one of the easier ways to do it. Quote Link to comment https://forums.phpfreaks.com/topic/207099-event-time-according-local-visitor-time/#findComment-1082867 Share on other sites More sharing options...
hitk Posted July 8, 2010 Author Share Posted July 8, 2010 Have a look at the mysql CONVERT_TZ function. I would guess it to be one of the easier ways to do it. It should not be that easy. Checked the updated post and you will get what I mean. How I know, from where the visitor is. Quote Link to comment https://forums.phpfreaks.com/topic/207099-event-time-according-local-visitor-time/#findComment-1082871 Share on other sites More sharing options...
Pikachu2000 Posted July 8, 2010 Share Posted July 8, 2010 If you can't use IP geolocation, the visitor would need to select his time zone, and have that info stored in a cookie. Otherwise, if you have your users register, they can set it in a preferences setting and store it in the database with the user's record. That can then be referenced whenever time info is needed. Quote Link to comment https://forums.phpfreaks.com/topic/207099-event-time-according-local-visitor-time/#findComment-1082872 Share on other sites More sharing options...
hitk Posted July 8, 2010 Author Share Posted July 8, 2010 If you can't use IP geolocation, the visitor would need to select his time zone, and have that info stored in a cookie. Otherwise, if you have your users register, they can set it in a preferences setting and store it in the database with the user's record. That can then be referenced whenever time info is needed. I dont have registration. I only provide data from mysql. I think something do with - http://www.maxmind.com/app/free Quote Link to comment https://forums.phpfreaks.com/topic/207099-event-time-according-local-visitor-time/#findComment-1082873 Share on other sites More sharing options...
Daniel0 Posted July 8, 2010 Share Posted July 8, 2010 How I know, from where the visitor is. Ask them. Quote Link to comment https://forums.phpfreaks.com/topic/207099-event-time-according-local-visitor-time/#findComment-1082923 Share on other sites More sharing options...
hitk Posted July 8, 2010 Author Share Posted July 8, 2010 Ask them. You didn't read the whole thread. Quote Link to comment https://forums.phpfreaks.com/topic/207099-event-time-according-local-visitor-time/#findComment-1082925 Share on other sites More sharing options...
Daniel0 Posted July 8, 2010 Share Posted July 8, 2010 Yes I did. You don't need registration to ask someone a question. Just display the timezone info next to the time and default it to the event's local time zone. Then have a drop down that allows people to select another timezone, and update the times accordingly. Quote Link to comment https://forums.phpfreaks.com/topic/207099-event-time-according-local-visitor-time/#findComment-1082965 Share on other sites More sharing options...
hitk Posted July 8, 2010 Author Share Posted July 8, 2010 Yes I did. You don't need registration to ask someone a question. Just display the timezone info next to the time and default it to the event's local time zone. Then have a drop down that allows people to select another timezone, and update the times accordingly. Is it not possible to detect timezone and display according. ? Quote Link to comment https://forums.phpfreaks.com/topic/207099-event-time-according-local-visitor-time/#findComment-1082988 Share on other sites More sharing options...
Pikachu2000 Posted July 11, 2010 Share Posted July 11, 2010 Yes I did. You don't need registration to ask someone a question. Just display the timezone info next to the time and default it to the event's local time zone. Then have a drop down that allows people to select another timezone, and update the times accordingly. Is it not possible to detect timezone and display according. ? Yes, but you still need to provide a way for the use to select the time zone they are actually in, when the geolocation detection is not correct, which appears to be about 21% of the time. If more than 1 out of every 5 visitors are not detected correctly, what's the point of doing it at all? Quote Link to comment https://forums.phpfreaks.com/topic/207099-event-time-according-local-visitor-time/#findComment-1084290 Share on other sites More sharing options...
Daniel0 Posted July 11, 2010 Share Posted July 11, 2010 Yes I did. You don't need registration to ask someone a question. Just display the timezone info next to the time and default it to the event's local time zone. Then have a drop down that allows people to select another timezone, and update the times accordingly. Is it not possible to detect timezone and display according. ? You could check the date/time info using Javascript and then change the times. Quote Link to comment https://forums.phpfreaks.com/topic/207099-event-time-according-local-visitor-time/#findComment-1084427 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.