I am pulling data from an XML feed via C# code. When I get the data, there is a datetime in the following format:
<a:updated>2010-11-05T20:21:43.8303793Z</a:updated>
I read that into variable of DateTime type. I then (using EF) to put that data into a table in my DB.
Later, when my code loops back around to download the feed again, I check to see if the value in the UPDATED field stored in my DB is the same as what is returned on the XML feed.
I am evaluating:
if (currentApp.Updated < app.Updated)
where currentApp.Updated is what's in my DB, and app.Updated is what has been read from the most recent XML feed download. Running it just now, both are showing (in the debug window):
{12/11/2010 8:13:44 PM}
but the IF statement is evaluating as TRUE. Looking deeper into the objects reveals:
currentApp.Updated.Ticks = 634276952242500000
app.Updated.Ticks = 634276952242511865
So when storing to the DB, it would appear that either C#, EF or SQL Server is dumping the last 5 digits (11865) and setting them to 0s (00000).
Color me frustrated. Any ideas how to solve this problem? My ideal is for that IF statement to eval false, since the UPDATED times are the same.