converting google latitude to a timezone

Discussion in 'Web Design and Development' started by kevindosi, Jul 13, 2009.

  1. kevindosi macrumors regular

    Joined:
    Mar 16, 2006
    #1
    I don't know if this is possible, and I don't know if this is the best place to ask it, but I figured that if it's possible then someone here would know how to do it.
    I'm using a plugin on wordpress to show my current location on my webpage with text (ie. "I'm currently in Houston, TX." I'd like to also put the current local time on my webpage automatically, so it'll say something like "I'm in Houston, TX and it's 5:00pm" Does anyone know if this is possible?
     
  2. kevindosi thread starter macrumors regular

    Joined:
    Mar 16, 2006
    #3
    Thanks for the reply,
    This looks fine, but I'm looking for something that will update automatically based on my current location according to google latitude. From what I can tell, this script can't do that. Is there any other way?
     
  3. kevindosi thread starter macrumors regular

    Joined:
    Mar 16, 2006
    #5
    Hey thanks for your response,
    I'm a little confused by this How could this be used to automatically update the local time based on my current location?
     
  4. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #6
    Let me unconfuse you.

    Visit this site to demo and possibly purchase their DB15 product which is a powerful and easy to use database that returns a lot of information about a user using geo-location techniques.

    http://www.ip2location.com/

    For example, I simply visited the site and it reported all this about me:

    As you can see, the database fields include longitude and latitude and time zone offset. You can either query based on IP as it did for me, or contact their helpdesk or read their documentation and see if you can run your own query passing the latitude/longtitude if you have that information already to get the time zone offset. Once you have that, you calculate local time by adding or subtracting the time zone offset from current GMT time.

    Example: GMT -4:00 means the current GMT time minus 4 hours, i.e. if GMT is 8pm, my local time is 4pm. It's up to you to query the database properly and calculate the time using whatever server side language you use. In PHP you'd work with gmdate and gmmktime functions.

    -jim
     

Share This Page