I have a partial view as the external lightbox. For some reasons, no matter what correct 12 hrs display format I used, the start and end dates always display in 24 hrs format (military time). I tried data annotation, and inline codes but nothing works.
// inline
@Html.TextBoxFor(m => m.start_date, "{0:MM/dd/yyyy h:mm tt}")
// Data Annotation
// in view
@Html.EditorFor(m => m.start_date)
// Model
public class Event
{
[DataType(DataType.DateTime)]
[Required(ErrorMessage = "This field is required")]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:MM/dd/yyyy h:mm tt}")]
public DateTime start_date { get; set; }
:
:
}
I think DHTMLx scheduler restricted it because when I changed the property name to something not “start_date” or “end_date”, they displayed correctly.
Please help. Thanks!