Im using the dynamics sdk for c# with early bound classes and the scenario is that when an opportunity is created and has certain criteria fulfulled then I send information about the Opportunity to another system.
We have a datetime field called "project start" that should be sent to the external system as UTC date. When I pick this date from a particular opportunity and run code on my development machine I currently get the correct date which means that 3pm in the opportunity is translated to 1pm in UTC date which is correct for my current location and timezone.
However, when I upload this code to the dynamics environment and make the same code execute on the same Opportunity then the date is sent to the external system as "3pm" which results in that the time is shown incorrectly in the external system.
My question is, how can the C# function Datetime.ToUniversalTime return different values when executed on the server compared to from my development machine?
When I do the logging I can see that the datetime format sent to the external system contains the "z" in the end to indicate that it is UTC format...
Help greatly appreciated!