Thursday, 6 November 2014

How to render a Datetime format in Razor (Asp.Net MVC)

We can change the Datetime formats in the MVC Razor, with applying  in the Model .

you have to write like this.

@Html.ValueFor(model => item.AddedOnTime, "{0:dd-MM-yyyy}")

There are so many ways to Convert Date formats in the Razor ASP.Net MVC, Using DisplayFor, Model ....
this is the simplest way i did.

No comments:

Post a Comment