navigation
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