Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    922
    Thanks
    302
    Thanked 3 Times in 3 Posts

    Question Getting user's timezone based on IP address

    Hi

    Is there anyway we can get user's timezone based on their IP address without using a paid 3rd party service?


    Thanks

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    You can try using the PECL geoip package: http://php.ca/manual/en/book.geoip.php
    This would let you retrieve information from the ip, and you can use that to feed into timezone fetch for the country and region (one of the functions in the package do that). That timezone can in turn be used with DateTimezone objects.

  • #3
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,193
    Thanks
    23
    Thanked 605 Times in 604 Posts
    It may be a lot easier to use javascript to do this. Here are some free tools http://www.iplocationtools.com/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •