• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
PowerCoder
博客园    首页    新随笔    联系   管理    订阅  订阅

C#中的DateTime、DateTimeOffset和TimeSpan(链接)

下面的微软官方文档,介绍了C#中的DateTime:

DateTime Struct

System.DateTime struct

其中这里有提到,DateTime的精度为100纳秒:

Time values are measured in 100-nanosecond units called ticks.

DateTime.Ticks Property属性可以返回DateTime代表的100纳秒数。而DateTime(Int64)构造函数,又可以将100纳秒数变回DateTime。

 

下面的微软官方文档,介绍了C#中的DateTimeOffset:

DateTimeOffset Struct

其中这里有提到,DateTimeOffset的精度为100纳秒:

The time component of a DateTimeOffset value is measured in 100-nanosecond units called ticks

DateTimeOffset.Ticks Property属性可以返回DateTimeOffset代表的100纳秒数。而DateTimeOffset(Int64, TimeSpan)构造函数,又可以将100纳秒数变回DateTimeOffset。

 

下面的微软官方文档,介绍了C#中的TimeSpan:

TimeSpan Struct

System.TimeSpan struct

其中这里有提到,TimeSpan的精度为100纳秒:

The value of a TimeSpan object is the number of ticks that equal the represented time interval. A tick is equal to 100 nanoseconds, or one ten-millionth of a second. 

TimeSpan.Ticks Property属性可以返回TimeSpan代表的100纳秒数。而TimeSpan(Int64)构造函数,又可以将100纳秒数变回TimeSpan。

 

posted @ 2024-12-11 21:05  PowerCoder  阅读(190)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3