I am trying to retrieve my data from CRM. But while doing that, it looks like it is applying culture to datetime field.
I have saved the datetime in CRM as - 01/08/2017 12:00 AM.
But when I retrieve this data with the help from FetchXML, its giving me 31/07/2017 06:30 PM
I have set culture in my global.asax file as -
protected void Application_BeginRequest()
CultureInfo info = new CultureInfo(System.Threading.Thread.CurrentThread.CurrentCulture.ToString());
info.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy";
System.Threading.Thread.CurrentThread.CurrentCulture = info;
<globalization culture="en-GB" />
foreach (var item in result2.Entities)
model.SightTestDate = Convert.ToDateTime(item["oph_claimreceiveddate"]);
Common date fields in records that are queried using the
IOrganizationService interface are returned as UTC
You need to convert these values to the proper time zone.