When Would You Prefer DateTime Over DateTimeOffset

后端 未结 3 1365
失恋的感觉
失恋的感觉 2020-12-02 15:12

A few months ago I was introduced to the new DateTimeOffset type and was glad DateTime\'s flaws with regard to time zones were finally taken care of.

However, I was

3条回答
  •  -上瘾入骨i
    2020-12-02 16:06

    Whilst I wouldn't PREFER to use DateTime over DateTimeOffset, please note that sometimes you NEED to, as MS .Net does not support DateTimeOffset as a DataColumn.DataType property DataColumn.DataType Property even though SQL datetimeoffset has been around since SQL2008.

    I myself had a problem with reading (ReadXml) a DateTimeOffset value of an XML exported DataSet with XmlReadMode.InferTypedSchema; it read it as a DateTime and crashed when I tried to merge it into a DateTimeOffset column

提交回复
热议问题