Waqar Malik Waqar Malik - 7 months ago 25
C# Question

Show current date time from CRM in the front end?

I have the logic below the Answer Value in CRM is 01/08/2015 23:00:00, however in the front end changes the expiry date to show 02/08/2015, its adding 1 day not sure why, how would I show the same date from CRM? below is my code, do I have to do below to show UTC now or something?

List<Answer> answers = Queries.FormAnswersQueries.GetAnswers(correctFormAnswer.Id).FetchEntities<Answer>(connection.OrganizationService);

if (answers != null)

answers = answers
.GroupBy(c => c.Question.Id)
.Select(g => g.OrderByDescending(c => c.CreatedOn).First()).ToList();

Answer Source

Dynamics CRM stores all datetime fields in UTC format in database. When retrieve this will come as it is & you have to convert to required local timezone.

Use LocalTimeFromUtcTimeRequest to manipulate the datetime.

The SDK Web Services can accept either a local datetime or a UTC datetime when performing a create/update, but will always return a UTC date on Retrieve/RetrieveMultiple.

Read more

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download