I am trying to convert DateTime.MinValue to a DateTimeOffset value but am getting an ArgumentOutOfRange exception.
I was looking at the the MSDN article on implicit conversions of DateTime to DateTimeOffset and the Exception section states that I'll receive this ArgumentOutOfRange exception when;
... The Coordinated Universal Time (UTC) date and time that results from applying the offset is earlier than MinValue. ...
Why then does the following code throw the exception;
DateTime test = DateTime.MinValue;
DateTimeOffset dto = test;
Is it simply due to my timezone? I am in GMT +8, but my understanding of the above code is that test is created with an Unspecified kind.
I am working around the issue by simply testing for MinValue of my DateTime, and if so, then using DateTimeOffset.MinValue instead.
I am merely curious as to why my unspecified kind DateTime object causes the error.