Difference between 'DateTime' and 'Dat

2019-02-21 09:24发布

问题:

This question already has an answer here:

  • When Would You Prefer DateTime Over DateTimeOffset 3 answers

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