I found out that an app I'm working on has a bug with date times being stored incorrectly in our database. I tracked it down to some inconsistency between how DateTime.FromBinary operates.
I am using this code as a test case:
var dateTime = DateTime.FromBinary(-8587689004854775808);
string toString = dateTime.ToString();
On my Windows PC (.NET 4.5, console app), as well as on my iOS app (Xamarin.iOS 8.10.0.267), I get the following result:
5/27/2015 12:00:00 AM
However, on our azure server it's coming out as the same date, but 6:00 AM.
As a quick test I fired up DotNetFiddle:
https://dotnetfiddle.net/ziBwfA
Sure enough the output there is:
5/27/2015 6:00:00 AM
Note that I also outputted the "Kind" property, and it came back as 'Local' so I don't think it's a local vs. utc issue.
Any thoughts as to why this might occur?