How can I get the CRM Region Settings? RRS feed

  • Question

  • So, I have built a time control out of an OptionSet.  Great so far.

    However I am using the time in an Azure Web Service so I get the time which is Local and then use it with a date which is UTC.

    Being in the UK, there is daylight savings time.

    I am looking to convert my time value in the Azure service to UTC which seems the easiest thing to do.  Does anyone know if I can get the CRM front-end region setting and use it in a flexible manner within the Azure Web Service code to amend the time?

    It will always be a UK CRM front end but it seems like an idea to write it to handle any front end region.

    The poor alternative might be to work out if I am in daylight savings time or not and adjust by an hour if necessary.

    Thursday, September 11, 2014 4:15 PM

All replies

  • In the interim I have written this:

    TimeZoneInfo zone = TimeZoneInfo.FindSystemTimeZoneById(Time.CRM_TIME_ZONE);
                return zone.GetUtcOffset(DT).Hours;

    ...where CRM_TIME_ZONE = "GMT Standard Time".

    If I can get that from CRM then it will be better. 

    I suppose I can set up a CRM config entity and type it into a text field for lookup too.

    Thursday, September 11, 2014 5:22 PM