Need to convert from LocalTime in any time zone to UTC time in Dynamics 365? The UtcTimeFromLocalTime request can help you with that. Check this out!

UtcTimeFromLocalTime – A function introduced in Dynamics 365 to allow you to convert time in any timezone to the corresponding UTC time. It has couple of parameters

  • LocalTime – DateTime object to set the local time
  • TimeZoneCode – Timezonecode of type integer.

So let’s see how we can put this in action


UtcTimeFromLocalTimeRequest request = new UtcTimeFromLocalTimeRequest();
        request.LocalTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Unspecified);
          request.TimeZoneCode = 190; // this is the timezone code IST


         UtcTimeFromLocalTimeResponse response = (UtcTimeFromLocalTimeResponse)service.Execute(request);
          var utcDateTime = response.UtcTime;



Observe how I have passed the LocalTime value. Please note that if you want to pass the current date time object, don’t use DateTime.Now as it may give undesirable results. Pass the datetime value using DateTIme.SpecifyKind as done in the above code.

If you want to pass some specific date time you can construct a datetime object like below.

request.LocalTime = new DateTime(2020,5,29,21,30,0);


Hope this helps!

Debajit Dutta

(Dynamics MVP)

For consultation/ corporate training visit or reach out to us at

Our product offerings:

CRM-Sharepoint Attachment uploader and metadata manager (

Notes Manager (

Role based views for Dynamics 365 (

Record Cloner for Dynamics 365 (




Published by


I am a Dynamics CRM Most Valuable Professional (MVP) with 12 years of experience in Microsoft .NET Technologies and 9 years of dedicated experience in Microsoft Dynamics CRM. I have worked with companies like Microsoft, SanDisk, PwC, TMF Group and have extensive experience of implementing complex CRM solutions from both offshore and client side. Currently the face of with significant experience in delivering corporate training on Dynamics CRM and have already delivered multiple projects to client through Author of multiple tools on codeplex including the 'Role Based Views' and 'CRM-Sharepoint Metadata manager & Attachment Extractor' which are available for commercial use under For consulting/ training, drop me a note at or visit our website

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s