I have one object called appointment
which has two properties: StartDate
and EndDate
.
When I make POST
request I send these values using ISOString
time .
this.appointment.StartDate.toISOString()
On the server-side, I received these properties with correct values. Also, it seems to be correct when I create model
in order to save appointment
to the database. I used .ToUniversalTime()
method.
var newAppointment = new Appointment()
{
StartDate =Convert.ToDateTime(model.StartDate).ToUniversalTime(),
EndDate = Convert.ToDateTime(model.EndDate).ToUniversalTime(),
SpecialityId = speciality.Id,
LocationId = location.Id,
PatientId = patient.Id,
UserId = user.Id,
Observations = model.Observations
};
But in database I found another values. Can explain somebody why is this behaviour ?
For instance, I used 2017.09.01 11:00
for StartDate
and in database i found 2017-09-01 08:00
The server and database is located in the westeurope
.