web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

DateTime UTC is different on server than on development environment

(0) ShareShare
ReportReport
Posted on by 40

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!

I have the same question (0)
  • Suggested answer
    meelamri Profile Picture
    13,218 User Group Leader on at

    Hi, 

    please refer to this blog: https://mscrm16tech.com/2019/09/07/date-time-issue-due-to-different-timezone-of-user-in-ms-crm/

    Good Luck !

  • Fedorov Profile Picture
    40 on at

    Hi,

    Thanks, the blog made sense and I tried the code which seems to make sense also.

    However I still get the same results with that code that once I upload the plugin to the server the time is off by two hours which I just cannot make sense of...

    I mean, the code from the link check for the date on the server and my dev environment, even though located on my local machine, makes requests against the same environment that I upload the plugin to...so I just think that the results should be the same with this new code but it isn't...

    Any more suggestions would be appreciated.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 184 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 138

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans