c# - DateTime 函数之间有什么区别?

标签 c# .net performance datetime

DateTime.NowDateTime.UtcNow 有什么区别。

有什么性能差异吗?

更新:我读了这篇文章 (http://www.nayyeri.net/the-darkness-behind-datetime-now),我认为我们有很大的不同,你不觉得吗?我想应该还有别的东西。

最佳答案

DateTime.Now

Gets a DateTime object that is set to the current date and time on this computer, expressed as the local time.

DateTime.UtcNow

Gets a DateTime object that is set to the current date and time on this computer, expressed as the Coordinated Universal Time (UTC).

至于性能 DateTime.Now 由于时区调整,速度稍慢。

您可以在 THIS 中找到更多详细信息线程。

关于c# - DateTime 函数之间有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6119430/

相关文章:

MySQL 查询性能 : individuate and rewrite faster query

c# - 如何在具有多个域的 ASP.NET MVC4 应用程序中允许 Windows 身份验证?

c# - 如何仅为可见元素引发 OnPropertyChanged?

c# - HTML Agility Pack,来自节点的SelectNodes

C# Transpose() 方法转置 excel 表中的行和列

performance - 字符串连接检查算法的运行时

ruby-on-rails - 为什么 ActiveRecord 对每个连接发出单独的查询?

c# - 我正在使用 OpenXML SDK 合并两个 Word 文档,但在将图像复制到标题中时得到损坏的文档

c# - 在 C# 中简化设置和部署

c# - 将 HTML 页面转换为 5 页以上的 pdf