I am saving two datetime variables to a SQL database (hosted in Azure) table using Entity Framework Core. Somehow when I query the database after saving, I noticed that the datetime values have changed. You can see the initial values just before saving below.
After saving, it shows in the database as follows
I read through several technical documentation to find the factors which could effect on this. Still, I did not find anything interesting.
Could you please help me to understand what’s behind this data change? I am pretty sure that there is no any stored procedure or some any other script that could change these dates either.
// step 3: update tblStudent
var tblStudentEntityToUpdate = await _applicationDbContext.Value.StudentApplications.FirstOrDefaultAsync(x => x.StudentID == vm.StudentID);
vm.GuardianID = guardianId;
_applicationDbContext.Value.Entry(tblStudentEntityToUpdate).CurrentValues.SetValues(vm);
await _applicationDbContext.Value.SaveChangesAsync();
.Kind
set to.Local
. Based on the stamps in the second screenshot, you're in Australia in AEST and Azure is converting this to UTC subtracting 10 hours.