I've already created another thread regarding this , but i want to make it more tidy and give more information.
I have two columns "StartDate" and "EndDate" . When i add the values and click save using this commands i get the correct dates as inserted :
DateTime startDate = Convert.ToDateTime(properties.ItemEventProperties.AfterProperties["StartDate"]); DateTime endDate = Convert.ToDateTime(properties.ItemEventProperties.AfterProperties["EndDate"]);
When i later on try to get the item using caml query with this code , i get the date 1 day before :
List leaveRequest = clientContext.Web.Lists.GetByTitle("LeaveRequest"); CamlQuery getApprovedLeaves = new CamlQuery(); string statusApproved = "Approved"; getApprovedLeaves.ViewXml = @"<View> <Query> <Where> <Eq> <FieldRef Name='Status'/> <Value Type = 'Choice'>" + statusApproved + @"</Value> </Eq> </Where> </Query> </View>"; ListItemCollection approvedLeaves = leaveRequest.GetItems(getApprovedLeaves); clientContext.Load(approvedLeaves); clientContext.ExecuteQuery();
This is strange issue. Please note that i 've changed the regional settings but my dev is stored on Azure , so i remotely connect to the VM and debug from there with Visual Studio.
Does anyone have any idea how to fix this?