c# .net Adsense ADO.NET Linq Viruses/security asp.net MVC JQuery Angular-js Node-js SEO Java C++ SQL API Networking vb.net .Net Css JavaScript Generics c#.Net entity framework HTML Website host Website Construction Guide HTTP tutorial W3C tutorial Web Services JSON Psychology Ionic framework Angular ReactJS Python Computer Android
asp.net MVC

How to format date using Hepler method in Asp.NET MVC?

| | ASP-NET , CSharp , MVC

In this article you will learn about how to display a DateTime value in dd/MMM/yyyy format by means of HTML Hepler methods in Asp.NET MVC.


  [DataType(DataType.Date)]

  [DisplayFormat(DataFormatString = "{0:dd-MMM-yyyy}", ApplyFormatInEditMode = true)]
       public DateTime PostedOn
        {
            get


            {
                return mPostedOn;


            }

            set

            {
                mPostedOn = value;


            }

        }

@Html.DisplayFor(m=> m.PostedOn, "{dd/MMM/yyyy}")

 


Output:


 


25-Feb-2016