Using Postman, or the C# program I have, I am trying to send a date to CRM. The date being passed is "2019-09-15", but when it shows up in CRM it is "2019-09-14".
In Postman, I am sending this in the PATCH
body:
{
"org_paymentreceived": "2019-09-15"
}
In the C# program, I am sending this:
{
"org_paymentreceived": Convert.ToDateTime(payment)
}
In both cases, it is quite clear 2019-09-15
is being passed, but still shows up as 2019-09-14
in CRM.
Dynamics CRM always stores as UTC in backend Datetime field, so whenever you are creating Datetime attribute make sure to set the behavior like timezone independent as you wish or user-local by default.
Otherwise, set the right timezone settings under personal options of that particular user account used for web api interactions as same as your user base.
The local datetime passed to CRM will be converted into UTC & stored. Then on retrieval reverse engineering is done.
CRM UI will render the current login user timezone based value in that datetime field. Whereas any SDK, web api call will fetch the UTC value as it is from database.