Jump to content

Recommended Posts

Hi,

 

I need to find out the local time of a place whose address is given to me.

 

For example : I am having the address like Columbus, OHIO, USA. I need to find the local time at Columbus. This I need in PHP.

 

Kindly help me to get this thing done. Is there any Function that PHP offers directly from where we can calculate the time from the address or we need to write something customized to get it done.

 

Any help in this regard is highly appreciated

 

Thank you

 

Very custom. You need to reverse geocode the address into a lat,long pair, then find out what time zone that position is in. You then have to compare the timezone your server is in with the calculated one, and adjust the time accordingly.

There is no built-in php function for this.  You can go the route of trying to compile a list of timezones for every location, or you can simply make a dropdown and allow the user to pick their own timezone.  You could possibly find a website that already has all that work done for you and you could possibly use curl to send/get the results, but that makes your script dependent on someone else's.  Most people opt for option #2.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.