locked
How do I find the incident timezone RRS feed

  • Question

  • Hi There,

    I have added a new Date and time field "Best Time to Call" in incident entity. While browsing that field value via online CRM it shows me the time as per local timezone (i.e., it shows me as per India timezone as that incident was created by India user). However, while coding I am getting the value as per UTC time. I have tried a lot to find the timezone of that incident as well as contact but in vain.

    Could you please let me know the code, how can I convert that date time value as per the contact's time zone?

    Thanks & regards,

    Biswa

    Monday, August 11, 2014 6:41 PM

All replies

  • If you’re coding on the server the

    DateTime.ToLocalTime

    is what you’re looking for.

    If you’re coding from Javascript then new Date(dateFromServerInUtc) will give you local time.

    e.g.

    var dateFromServerInUtc = xrmForm.Fetch( "Xml Qurey");
    alert(new Date(dateFromServerInUtc));

    Cheers


    Dev Blog: Dynamics CRM - Thinking outside the Box

    Tuesday, August 12, 2014 1:57 AM
  • Thank you for your quick response.

    Yes, I am looking for the C# coding for our portal which is communicating with CRM online by using xrm proxy class.
    I have tried "DateTime.ToLocalTime". It is looking fine from India time zone desktop, however, it's showing wrong at UK time zone desktop. Where as at online CRM it is showing the same in both the time zone.

    For e.g.,

    At online CRM, the Value of "Best Time To Call" field is showing as 18/07/2014 16:30 in all time zone.
    However, at my portal (with "DateTime.ToLocalTime" code), for India time zone it is showing as 16:30  and for UK time zone it is showing "12:00".

    Tuesday, August 12, 2014 6:28 AM