I need to have the time in 3:15 PM format without seconds. I am using jquery timepicker but its always giving me the error. THE VALUE '3:15 PM' IS NOT VALID FOR TIME The code is provided... Can anyone please help.... Model Class [Required(ErrorMessage = "{0} is required")] [Display(Name = "Test Time")] [DataType(DataType.Time)] [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:hh:mm}")] //[RegularExpression(@"^(0[1-9]|1[0-2]):[0-5][0-9] (am|pm|AM|PM)$", ErrorMessage = "Invalid Time.")] public TimeSpan TestTime { get; set; } <pre> View <div class="col-md-6"> @Html.LabelFor(model => model.TestTime, new { @class = "control-label" }) <div class="input-group"> <div class="input-group "> <span class="input-group-addon" style="background:white"> <i class="fa fa-clock-o" style="color:#179CDC;"></i> </span> @*<input type="text" class="form-control timepicker timepicker-no-seconds">*@ @Html.TextBoxFor(model => model.TestTime, "", new { @class = "form-control timepicker timepicker-no-seconds time" }) @*@Html.TextBoxFor(model => model.TestTime, "", new { @class = "form-control timepicker timepicker-24 time" })*@ <span class="input-group-btn"> <button class="btn btn-info" type="button"><i class="fa fa-clock-o"></i></button> </span> </div> </div> @Html.ValidationMessageFor(model => model.TestTime, string.Empty, new { @class = "small text-uppercase text-danger" }) </div>
DateTime
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)