Here there,
In the Class XmpDateTime, the method XmpDateTimeToDateTime try to create a .Net DateTime from a PInvoke.XmpDateTime.
There's a problem when a date time in the Xmp metadata contains millisecond such as : <xmp:ModifyDate>2009-04-14T15:07:34.22-04:00</xmp:ModifyDate>
In the XmpDateTime type, there's no millisecond attribute. There's only a NanoSecond attribute. So when we convert convert the xmp date time to a .NET date time, the xmpDateTime NanoSecond attribute contains 220 000 000 (220 millions). We try to create a .NET date by providing the nanosecond in the millisecond .net datetime parameter.
The value range for milliseconds are 0 throught 999. We put a value of 220 000 000 in that range. It throws an error.
Why are we creating a .net date time by suppluying nanosecond into millisecond ??
The value in millisecond shall be 220. We divide 220 000 000 nanosecond by 10000000(one million) to get the right conversion(220).
Any help ??
I made a temporary fix by doing this :
int milliseconds = xmpDateTime.NanoSecond/1000000;
return new DateTime(xmpDateTime.Year, xmpDateTime.Month, xmpDateTime.Day, xmpDateTime.Hour, xmpDateTime.Minute, xmpDateTime.Second, milliseconds, DateTimeKind.Local);