c# - DateTimeKind 不会更改 UTC/Local/Unspecified 之间日期的任何部分

标签 c# datetime timezone timezone-offset

Hello

这怎么可能?我预计 UTC 和本地之间至少有 1 小时的时差

在 Visual Studio 中使用 C# 查询 azure 上的 cosmosDB 时出现了这个问题

最佳答案

As per the MSDN Docs, DateTimeKind Enumeration Specifies whether a DateTime object represents a local time, a Coordinated Universal Time (UTC), or is not specified as either local time or UTC.

这意味着,它不会为您提供转换后的时间,但是,DateTimeKind 枚举的成员用于本地时间和协调世界时 (UTC) 之间的转换操作,但不用于比较或算术运算。

enter image description here

关于c# - DateTimeKind 不会更改 UTC/Local/Unspecified 之间日期的任何部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52111681/

相关文章:

C# 从哪里返回 JSON

javascript - 为什么我不能从包含毫秒的字符串创建日期?

c# - session 值返回 null

c# - xUnit.net:全局设置+拆卸?

mysql - 选择所有日期时间的数据

javascript - 如何在 javascript 中将日期时间微格式转换为本地时间?

Swift CLGeocoder 获取时区

wpf - C#如何获取不同国家的当前时间

c# - 具有敏感数据的 Sitecore WFFM

datetime - 如何从 Excel VBA 宏获取 UTC 中的当前日期时间