How to format dates in MVC 5 Razor
|Added at||2017-01-03 23:01|
I have a table in my razor code that loops through all of the items in the model and creates a table row for each item. I'm trying to figure out how to format the date to MM/dd/yyyy instead of the default "MM/dd/yyyy HH:mm:ss" format.
I have tried @item.ExpireDate.ToString("MM/dd/yyyy") but it throws an error saying that .ToString does not take an argument.