Reputation: 1109
I want to change my time from
06/08/2015 15:55:31
to
06/08/2015 03:55 PM
Here is my code.
<td >
@Html.DisplayFor(modelItem =>item.Received) //Date Column
@Html.HiddenFor(modelItem => item.Received, new { @class = "fieldName" })
</td>
Upvotes: 0
Views: 2152
Reputation: 2061
you can use this attribute to format date as required on the Received property of your model
[DisplayFormat(DataFormatString = "{MMMM 0:dd yyyy}")]
Upvotes: 0
Reputation:
Decorate your property with the DisplayFormatAttribute
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy hh:mm tt}")]
public DateTime Received { get; set; }
Upvotes: 2