web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Posting Date values through Web API displaying incorrectly in CRM

(0) ShareShare
ReportReport
Posted on by 2,175

Hi all

I've got a question. We are doing a website integration from an online form that has a date and time field passed through to a date and time field (set to timezone independent) in the CRM. 

We are using the CRM REST builder to build the create request and when executing it seems fine. The only problem is that when for example I set the start date and time on the website form to

23/05/2018 9:00am

It passes through to the CRM as 22/05/2018 11:00pm. I understand CRM stores date and time as UTC but I would of expected setting the field as timezone independent would mean it would no longer convert the time to the user local time when viewing in the CRM. The code snippet the REST builder generates is:

startdateandtime = new Date("05/23/2018 09:00:00").toISOString();

But when viewing the CRM entity record it's set it to 22/05/2018 11:00pm. Any help would be greatly appreciated.

Kind regards

Mike

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Nithya Gopinath Profile Picture
    17,078 on at

    Hi Mike,

    Time-Zone Independent format saves in UTC on the backend without converting the time-zone.

    Try changing the date field to UTC and post the UTC value to the date time field in Web API.

    DateTime date = new DateTime(2018, 5, 23, 9, 0, 0).ToUniversalTime();

    Hope this helps.

  • Suggested answer
    keyur7379 Profile Picture
    902 on at

    Hi,

    please use this.

    DateTime date2 = utcDate1.ToLocalTime();

  • MikeC282 Profile Picture
    2,175 on at

    Thanks all,

    Both solutions worked.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans