获取当前国家的国家名称和时间戳

本文关键字:国家 时间戳 获取 | 更新日期: 2023-09-27 18:15:34

我正在制作一个WPF应用程序。我怎么能得到谁是使用我的应用程序国家名称和时间戳的人。我不知道这应该怎么做,我猜我们需要用户的IP地址?

获取当前国家的国家名称和时间戳

String CountryShortCode=GetCountry();

方法是这样的

 static public string GetCountry()
    {
        return new WebClient().DownloadString("http://api.hostip.info/country.php");
    }

然后用CountryShortCode设置TimeZone,根据ThatCountry

得到TimeStamp

链接正常:http://www.aspsnippets.com/Articles/How-to-get-Country-Name-from-IP-Address-in-ASPNet-using-C-and-VBNet.aspx