Re: Re: User Timezone

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 21, 2012 at 12:56 AM, Karl DeSaulniers <karl@xxxxxxxxxxxxxxx> wrote:
>
> On Oct 20, 2012, at 7:23 AM, Maciek Sokolewicz wrote:
>
>> On 20-10-2012 09:39, Karl DeSaulniers wrote:
>>>
>>> Hello all,
>>> Happy weekend. Hoping you can help me with an age old question.
>>> I am trying to get a users timezone for a purchase online.
>>> I know that php is not really able to get a timzone of a user because
>>> its a server side execution with the date functions.
>>> But I wanted to get a little help on my work around. I am hoping someone
>>> can help. TIA
>>>
>>> I have a form that a user must fill out in order to purchase anything.
>>> On this form they are required to put their city, state, country and zip
>>> code.
>>> These are all required fields.
>>>
>>> Now, I know there is a way to get a timezone offset if you have a
>>> location to offset.
>>> So is there a way based on the fields provided that I can get that
>>> offset for each user?
>>>
>>> (The users have to put a correct city, state, country and zip in order
>>> to get there purchase.
>>> This address has to match their paypal or cc address in order to
>>> purchase as well.
>>> So I know there will still be a margin of error with user manipulated
>>> info. So that is moot point for now.)
>>>
>>> My thoughts are to get a timezone offset based on the country and zip
>>> code, with a backup check of city state country zip.
>>> I just don't know where to start looking for how to get the timezone or
>>> UTC location based on country and zip or city state country zip.
>>>
>>
>> Hi Karl,
>>
>> so basically what you're looking for is a database map between timezone
>> and country/state/zip.
>>
>> Did you try to google such a thing?
>>
>> One of the first posts I found was a StackOverflow question about this;
>> one of the answers mentioned just such a database on Tom Boutell's website
>> (the same person who created the GD library [used for image-creation in
>> php]): http://www.boutell.com/zipcodes/
>> It includes states, cities, zip codes, etc. for the USA. Since you
>> specifically mentioned you want to find it "by state", it means you're
>> mainly focussing on the USA (barely any other country even bothers with
>> states).
>>
>> Apart from the above data, I'm sure you can find more on google.
>>
>> Good luck.
>> - Tul
>>
>
>
> Thanks for the response. Yes, for the US I plan on calculating by state, but
> this website is not geared to just the US.
> So I am looking for a solution that lets me also calculate by
> country/region.
> Was looking on google and found geoip, but not sure if this will do the job
> I am looking for.
> Anyone with experience on geoip that can send pointers?
>
> Thanks,
>
>
> Best,
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com


Geo IP is based on IP, and I must warn you that IP data is not always
accurate. Especially here in Europe, companies that are based in
multiple countries sometimes only register their IPs in a single
country, and share them between all the countries they are active in.
This will give you wrong data from GeoIP. The time difference will
only be 1 hour at max, but still.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux