I need some help.
On my system, I have an input that brings up a date from the database.
Asyoucanseeinthepictureabove,thereporteddateis06/09/201700:00
,buttheactualdateofthisfieldis05/09/201722:03
.
Theformatthatisinmydatabaseisthus2017-09-0522:03:03.757
andjustbelowismyinputthatpullsthisdate.
<inputtype="text" class="form-control" style="text-align: center;" value="@(Model.DataRandomizacao?.ToString("dd/MM/yyyy HH:mm") ?? "Não randomizado")" disabled>
Can anyone help me?
I was able to resolve it this way.
@{ DateTime RandomizacaoData = Convert.ToDateTime(ViewBag.Randomizacao.RandomizacaoData); }
<input type="text" class="form-control" style="margin-left:0; text-align: center;" value="@RandomizacaoData.ToString("dd/MM/yyyy HH:mm")" disabled>
I just need that if there is no date it will appear "Not Randomized" as the old example.