format displayfor as date with out the time in c#

37 Views Asked by At

Sorry this is probably duplicated but I couldn't find the right solution.

I want to format my display for to only show the Date not the time as it does now.

Ive tried these things below that i found in similar posts on stack.

 <a href="@(Url.Action<SchedulesController>(c=>c.Edit(schedule.Id)))" class="date">@Html.DisplayFor(m => schedule.UTCStartDate, new { @Value = schedule.UTCStartDate.ToString("dd-MMM-yyyy") })</a>

and

 <a href="@(Url.Action<SchedulesController>(c=>c.Edit(schedule.Id)))" class="date">@Html.DisplayFor(m => schedule.UTCStartDate, "{0:dd/MM/yyyy}" )</a>

How do i just get the date to show? Can I do it on the view or do I need to do it in the viewmodel.

0

There are 0 best solutions below