Sunday, 15 May 2011

asp.net mvc - What date format should be set to show am/pm in lower case? -


I am developing the MVC 3 application. In the view I am displaying the name along with the date time created. This is displayed as a

Nick Morris 27-Mar-13, 11:49 am, <->

, but I I want to show in

  [DisplayFormat (DataFormatString = "{0: DD MMM yy hh: mm tt}")] Public System Create datetime data {get; Set; }   

and I am using the code in the view ... . @ html.DisplayFor (ModelItem = & gt; item.CommentDateTime.ToString ("Dddd, MMMM d, yyyy a \\ th: mmtt"))

What do I change in the date format? This error is showing.

You can see it in the DisplayFor assistant:

  @ Item.CommentDateTime.ToString ("dd-MMM-yy hh: mm") @ item.CommentDateTime.ToString ("tt"). ToLower ()   

In this case you do not need the DisplayFormat attribute on your visual model.

No comments:

Post a Comment