7 lines
735 B
Plaintext
7 lines
735 B
Plaintext
=== Pitfalls
|
||
|
||
Common `DateTime` pitfalls include:
|
||
|
||
* when working with `DateTime` of kind `Local` consider the time offset of the machine where the program is running. Not storing the offset from UTC separately can result in meaningless data when retrieved from a different location.
|
||
* when working with `DateTime` of kind `Unknown`, calling `ToUniversalTime()` presumes the `DateTime.Kind` is local and converts to UTC, if you call the method `ToLocalTime()`, it assumes the `DateTime.Kind` is UTC and converts it to local.
|
||
* when comparing `DateTimes` objects, the user must ensure they are within the same time zone. `DateTime` doesn’t consider UTC/Local when comparing; it only cares about the number of `Ticks` on the objects. |