Difference between 'DateTime' and 'DateTimeOffset' [duplicate]

南楼画角 提交于 2019-12-09 02:06:57

问题


What is difference between a DateTime and a DateTimeOffset object?

And when should we use each one?

In a web-application that may change the server's area, storing date and time. Which one is better, or is there any other suggestions?


回答1:


DateTimeOffset Represents a point in time, typically expressed as a date and time of day, relative to Coordinated Universal Time (UTC) it provides a greater degree of time zone awareness than the DateTime structure. See it here- http://msdn.microsoft.com/en-us/library/bb546101.aspx.




回答2:


DateTimeOffset Overcomes the drawback of DateTime. It expressed as a date and time of day, relative to Coordinated Universal Time (UTC). For Example:

Given 4/18/2013 11:00:00 AM means absolutely nothing if you don't have a reference point. That could be 11:00:00 AM anywhere in the world. DateTimeOffset contains information about the timezone you are dealing with, which makes all the difference in THE WORLD!

To more details must read once



来源:https://stackoverflow.com/questions/9073149/difference-between-datetime-and-datetimeoffset

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!