Time display format

I need display time in my MVC4 app in a specific format.

[DisplayFormat(DataFormatString = "{0:f}")] public DateTime Eve_Date { get; set; } 

I am using the above format.

I need a date in the following format: Sun, 11 July 2013, 5.30 PM . How is this possible?

+4
source share
2 answers

Try this code,

 [DisplayFormat( DataFormatString="{0:ddd, d MMMM yyyy, hh.mm tt}", ApplyFormatInEditMode=true )] public DateTime Eve_Date { get; set; } 

Using

 @Html.EditorFor(m => m.Eve_Date) 
+6
source

Try the following:

 Eve_Date.ToString("ddd, dd MMMM yyyy, h.mm tt") 
0
source

Source: https://habr.com/ru/post/1492645/


All Articles