I am working on a requirement where I will save the Date of Submission value of a customer. It works perfect. But the problem is, when I fetch that data related to customer and rendering it in the UI, the date of submission is being displayed wrong. For suppose if I save it as 01/01/2019, it displays as 12/31/2018 11:56PM. This happens only when I change the timezone. In my local timezone it works perfect. But, when I change it to some other timezone, it displays like the above or some other value based on the timezone.
I am using Asp.Net MVC, C#.Net. I debugged the application and checked that the date that was being returned from the database is perfect, which is 01/01/2019 12:00AM. But when this is being rendered, it is displaying the incorrect value.
Here is the code that I am using to render the values to UI. I only included this piece of code because whatever I am getting to the model was good. The issue seems to be happening at the time of rendering. Can someone please help me out with where I am going wrong or what can I do to the above code to fix this issue?
<div class="form-group margin-top-10">
@ProjectHolder.LayoutHForm(new { @class = "v-split-4" }, null,
x => x.mdl.FullName,
x => x.mdl.SRNumber,
x => x.mdl.DateOfSubmission,
x => x.mdl.IsMale,
x => x.mdl.EmailAddress)
</div>