获得国家和时间戳当前位置

获得国家和时间戳当前位置

本文介绍了获得国家和时间戳当前位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道我的应用程序使用。

I want to know where my application is used.

下面是获得国家名称的代码:

Here is the code for getting the country name:

public string Country = RegionInfo.CurrentRegion.DisplayName;

下面是代码来获取时区:

Here is the code to get the timezone:

public void TimeStamp()
{
    TimeZone zone = TimeZone.CurrentTimeZone;
    // Demonstrate ToLocalTime and ToUniversalTime.
    DateTime local = zone.ToLocalTime(DateTime.Now);

    _TimeStamp = local.ToString();
}



我想看看,如果这个工程的其他地点和IP地址。我曾试图改变使用cyperghost我的IP地址,但没有改变。我住在丹麦和上面的代码中仍然显示丹麦xx.xx.xx xx.xx.xx。

I want to see if this works for other locations and IP addresses. I have tried to change my IP address using cyperghost, but nothing changed. I live in Denmark and the code above still shows "Denmark xx.xx.xx xx.xx.xx".

如何测试如果这个代码实际工作,因为我希望它?

How can I test if this code actually works as I want it to?

推荐答案

的属性返回从当前PC的信息。所以,你可以改变你的日期和时区,并检查:

TimeZone.CurrentTimeZone property returns information from your current PC. So, you can change your date and timezone and check:

这篇关于获得国家和时间戳当前位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 03:17