I know this does not work but I was hoping to get something like this to work in my HTML View using ASP.NET MVC and C#.
My timestamp date (a database value) minus DateTime.Now greater than 12 hours then do this….
@foreach (var cont in contents)
{
if (cont.IsArchive == null)
{
<tr>
<td>
@Html.DisplayFor(modelItem => cont.ToolList_Text)
</td>
<td>
@Html.DisplayFor(modelItem => cont.GenericDropDownList_Text)
</td>
<td>
@Html.DisplayFor(modelItem => cont.Comment_Text)
</td>
@if (cont.TimeStamp - DateTime.Now >= 12)
{
<td>
@Html.DisplayFor(modelItem => cont.TimeStamp)
</td>
}
<td class="text-center">
<div style="display: inline-flex;">
<button type="submit" value="Edit" class="btn btn-info" id="edit" name="edit">Edit</button>
<button type="submit" value="Archive" class="btn btn-danger" id="archive" name="archive">Archive</button>
</div>
</td>
</tr>
}
}
I tried different ways to present the >= but still not working