I just can't seem to find an answer for this hence the post. I want the time stored in the SQL database to be displayed on my website to be the exact time that is in the database. Currently, this is not the case. The time being displayed is being converted to the browsing computers local time. Since the time being saved is an appointment time, regardless of where or what time zone the browsing computer is in, having it converted makes no sense. I thought that the methods TimeZone and TimeZoneInfo were used to convert the time to local time, but this seems to be happening automatically. How do I get the exact time saved to be the time displayed on my site?
The SQL database fields ETAStart and ETAEnd are defined as datetime.
Updates to the database are handled in the controller as such:
if (TryUpdateModel(model)) {
System.DateTime ETAEnd = Convert.ToDateTime(model.ETAStart).AddHours(3);
model.ETAEnd = ETAEnd;
model.UpdatedBy = CurrentUser();
model.UpdateDate = Convert.ToDateTime(DateTime.Now.ToString("U"));
dc.SubmitChanges();
return View(new GridModel<ManifestMasterModel> { Data = GetMMList(0) });
} else {
return View();
}
Thank you in advance and I am very appreciative to all who respond.