IP到位置+当地时间? [英] IP to location + local time?

查看:93
本文介绍了IP到位置+当地时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我一直在使用 http://www.geoiptool.com/,但是我不能得到当地时间.我不知道如何获取当地时间.

Currently I've been using http://www.geoiptool.com/ but I can't get the local time. I don't know what to do to get the local time.

有人可以帮我显示位置+当地时间吗?我有一个邮件应用程序,我尝试显示IP地址+当地时间.

Can someone help me out, to display location + local time? I have a mail app and I try to display IP in location + local time.

推荐答案

这不是您问题的真正答案,但可以帮助您正确了解此方法的不准确之处.

Well, this is not real answer to your question but can help you to properly understand how inaccurate this method is.

请阅读此答案作为旁注.

是的,可以为您的用户提供或设置位置/时间.但是您也应该为他们提供国家/时间选择器.某些IP无法正确解析(匿名代理,从其他国家借入的IP(以我的情况为例),大陆IP(例如欧洲",亚洲"组等)等等.

Yes, it's OK to offer or set location/time for your users. But you should provide country/time selector for them also. Some of IP's can not be resolved properly (anonymous proxy, borrowed IPs from other countries (my case), continental IPs (like group "Europe", "Asia", etc), etc.

我的案例显示了这种方法可能是错误的.

My case shows how this approach may be wrong.

当我从geobytes.com尝试ipLocator时,我得到了:

When I've tried ipLocator from geobytes.com I've got this:

我的IP地址已解析为:

My IP address has been resolved to:

  • 位置:罗马尼亚
  • 时间偏移: +0200 (当前DST处于活动状态,因此它为+0300)
  • Location: Romania
  • Time offset: +0200 (at the moment DST is active so it's +0300)

真正的问题是我的位置不是 Romania,并且我的时间偏移是+0100/+0200.

Real problem is that my location is not Romania, and my time offset is +0100/+0200.

看这张照片:

红色箭头显示了我的真实位置.黑框中的信息会显示我的真实位置的正确值.嗯,错误的位置对于用户来说不是什么大问题,但是错误的本地时间是非常令人讨厌的事情.

Red arrow shows my real location. Info in black box shows correct values for my real location. Well, wrong location is not such a big problem for users, but wrong local time is very annoying thing.

是的,我知道,这不是您想要的.但是您不应该确定用户的位置和/或本地时间,因为这可能是错误的方法. IPv4地址肯定不能准确获取有关用户的真实信息.

Yes, I know, that's not what you're looking for. But you should not fix users location and/or local time because it can be wrong approach. IPv4 address is certainly not something accurate to get real info about user.

此外,我发现ipLocator不遵循DST规则,使用该时间偏移量(图像#1)会在夏季(对于考虑DST的国家/地区/省)显示错误的本地时间.

Also, I found that ipLocator doesn't follow DST rules and using that time offset (image #1) will show wrong local time during Summer (for countries/regions/provinces which consider DST).

这篇关于IP到位置+当地时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆