Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# UTC和世界时_C#_.net_Datetime - Fatal编程技术网

C# UTC和世界时

C# UTC和世界时,c#,.net,datetime,C#,.net,Datetime,在C#中,UTC和世界时的区别是什么? 可用的功能有哪些?没有区别。DateTime.UtcNow以UTC为单位提供当前时间。Timezone类具有将UTC日期/时间转换为任何时区中的日期/时间的函数。没有区别。DateTime.UtcNow以UTC为单位提供当前时间。Timezone类具有在任何时区转换UTC日期/时间和UTC日期/时间的函数。我认为它们是相同的-根据,UTC是协调的*世界*时间 .NET通过结构上的许多函数支持UTC。例如,有像DateTime.ToUniversalTime

在C#中,UTC和世界时的区别是什么?
可用的功能有哪些?

没有区别。DateTime.UtcNow以UTC为单位提供当前时间。Timezone类具有将UTC日期/时间转换为任何时区中的日期/时间的函数。

没有区别。DateTime.UtcNow以UTC为单位提供当前时间。Timezone类具有在任何时区转换UTC日期/时间和UTC日期/时间的函数。

我认为它们是相同的-根据,UTC是协调的*世界*时间


.NET通过结构上的许多函数支持UTC。例如,有像
DateTime.ToUniversalTime
(当然还有
DateTime.ToLocalTime
转换回)或
DateTime.UtcNow
这样的函数可用。

我认为它们都是一样的-根据,UTC是协调的*世界*时间

.NET通过结构上的许多函数支持UTC。例如,有像
DateTime.ToUniversalTime
(当然还有
DateTime.ToLocalTime
转换回)或
DateTime.UtcNow
这样的函数可用。

UTC=世界时

您可以通过以下方式将当前本地时间转换为UTC:

DateTime dt= DateTime.UtcNow;
或将指定的日期/时间转换为

TimeZoneInfo myTZInfo = TimeZoneInfo.FindSystemTimeZoneById("AUS Eastern Standard Time");

// DateTime.SpecifyKind(Convert.ToDateTime("04:35 AM"), DateTimeKind.Unspecified), myTZInfo) tells whether you are conetring a local time or UTC, you can always leave it as unspecified

TimeZoneInfo.ConvertTimeToUtc(DateTime.SpecifyKind(Convert.ToDateTime("2015-01-06 14:00:00.000"), DateTimeKind.Unspecified), myTZInfo).ToString("hh:mm tt")
您可以通过==>

ReadOnlyCollection<TimeZoneInfo>  tzc= TimeZoneInfo.GetSystemTimeZones();
ReadOnlyCollection tzc=TimeZoneInfo.GetSystemTimeZones();
UTC=世界时

您可以通过以下方式将当前本地时间转换为UTC:

DateTime dt= DateTime.UtcNow;
或将指定的日期/时间转换为

TimeZoneInfo myTZInfo = TimeZoneInfo.FindSystemTimeZoneById("AUS Eastern Standard Time");

// DateTime.SpecifyKind(Convert.ToDateTime("04:35 AM"), DateTimeKind.Unspecified), myTZInfo) tells whether you are conetring a local time or UTC, you can always leave it as unspecified

TimeZoneInfo.ConvertTimeToUtc(DateTime.SpecifyKind(Convert.ToDateTime("2015-01-06 14:00:00.000"), DateTimeKind.Unspecified), myTZInfo).ToString("hh:mm tt")
您可以通过==>

ReadOnlyCollection<TimeZoneInfo>  tzc= TimeZoneInfo.GetSystemTimeZones();
ReadOnlyCollection tzc=TimeZoneInfo.GetSystemTimeZones();