DateTime.Now vs. DateTime.UtcNow

后端 未结 13 1483
暗喜
暗喜 2020-11-28 17:43

I\'ve been wondering what exactly are the principles of how the two properties work. I know the second one is universal and basically doesn\'t deal with time zones, but can

13条回答
  •  借酒劲吻你
    2020-11-28 18:22

    DateTime.UtcNow is a Universal time scale omitting Daylight Savings Time. So UTC never changes due to DST.

    But, DateTime.Now is not continuous or single-valued because it changes according to DST. Which means DateTime.Now, the same time value may occur twice leaving customers in a confused state.

提交回复
热议问题