locked
CRM 2011, Date in plugin and DST RRS feed

  • Question

  • I have one issue which I resolved by myself but yet need some confirming words weather I am 100% correct on my thought, just because there is not any documentation I found to prove myself correct.

    My server is in DST time currently,CRM UI is also showing 1 hour up then data stored in db. that's fine.

    When I calculate and store date with plugin, after my plugin update operation finishes, CRM platform deducts 1 hour in data I saved. I have read that when we do some operation via SDK related date time, CRM stores date time as it is. is it the case that when time is in DST, platform also get involves to deduct 1 hour by then ?

    As a resolution, I have commented out my line of deducting 1 hour and letting CRM to do it now.

    Am I correct on my understanding or it would be appreciable if some one can provide any documentation URL.

    Regards, Hiren Solanki.


    Thanks and regards,
    Hiren Solanki.
    Please vote or mark as a answer if it helped you.

    Tuesday, April 1, 2014 7:08 AM

All replies

  • Hello,

    Not sure if I understand you correctly, but CRM always stores UTC value format in db, and if you are setting any datetime field in your plugin you should set in UTC format.

    Check this


    Our Website | Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Tuesday, April 1, 2014 7:54 AM
    Moderator
  • Hi Mahender,

    Thanks for replying.

    Date conversion is not an issue here. Just need to confirm that CRM stores exactly date in DB whatever is populated in plugin. right ?

    Entity case = new Entity("incident");
    case["new_datefield"] = DateTime.Parse("4/1/2014 1:40 PM");
    service.update(case);

    If you consider above, code then I assume that "new_datefield" will have exactly value stored in DB when provided. Now the same operation is performed when server time is in DST. Based on my observation in my current data CRM platform deducts 1 hour after plugin update operation is fired. is it true ?

    Regards,

    Hiren.


    Thanks and regards,
    Hiren Solanki.
    Please vote or mark as a answer if it helped you.

    Tuesday, April 1, 2014 8:17 AM
  • Hello,

    This is only because DB store date in utc format that's why you are able to see datetime difference and if you need to set value you should use utc date only like below for example if we need to set current datetime

    case["new_datefield"]=DateTime.UtcNow;


    Our Website | Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Tuesday, April 1, 2014 8:37 AM
    Moderator