locked
How to handle Daylight saving timings in MS CRM 2011/2013 Plug-in RRS feed

  • Question

  • Hi All,

    Is there any solution to handle Daylight saving timings in MS CRM 2011/2013 Plug-In

    it would be great if anybody can provide the solution.

    Thanks

    Srikanth

    Thursday, June 9, 2016 3:50 PM

All replies

  • Hi,

    What do you mean by "handle daylight saving". CRM does some sort of handling already, I'm not entirely sure that it is super duper up to date though but that can sort of easily be checked.

    Regards


    Rickard Norström Developer CRM-Konsulterna
    http://www.crmkonsulterna.se
    Swedish Dynamics CRM Forum: http://www.crmforum.se
    My Blog: http://rickardnorstrom.blogspot.se

    Monday, June 13, 2016 9:01 AM
  • First of all, DateTime is stored in CRM in UTC format. So in order to get ldaylight saving info, you need to know what time zone you are doing your calculation based on. If you are doing some kind of timer or function based on the local time, you need to know what time zone you are in to work with.

    to get the local time zone, you can get either get from user profile settings, or even hard code it if you know it.. Here is a conversion code from UTC to a local time and hope it will help you.

                    var request = new LocalTimeFromUtcTimeRequest
                    {
                        TimeZoneCode = timeZoneCode,
                        UtcTime = ServerDateTime
                    };

                    var response = (LocalTimeFromUtcTimeResponse)service.Execute(request);
                    return response.LocalTime;

    this is the list of timezone codes: https://technet.microsoft.com/en-us/library/aa226764(v=sql.80).aspx

    Monday, June 20, 2016 3:20 PM