Recently, I tried to get datetime value from custom field in Invoice entity throuhg plugin and found that it returns a day before the date displayed in CRM form. For incstance, I entered "7/1/2013" and in my C# the following code returns "6/30/2013":
EntityReference eRef = new EntityReference(localContext.PluginExecutionContext.PrimaryEntityName, localContext.PluginExecutionContext.PrimaryEntityId);
var invoice = localContext.OrganizationService.Retrieve(eRef.LogicalName, eRef.Id, new ColumnSet(true));
string start = ((DateTime)invoice["revg_startdate"]).ToString(); //here I get 6/30/2013
Then I checked the actual datetime in relevant MS SQL table, and it keeps exactly a day before, "6/30/2013"
The date, time and timezones are absolutely identical on server, my PC and in CRM.
Why CRM keeps and displays different dates?