First step
install Jquery Ui Datepicker from manage Nuget package solutions
jQuery UI (Combined Library)
View
@Html.EditorFor(model => model.InputDate, new { htmlAttributes = new { @class = "form-control" } })
add jQuery code in this section
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#InputDate").datepicker();
$("#OutDate").datepicker();
});
</script>
}
This is for covertion of Date Time format
in only in view side
<span class="">@Convert.ToDateTime(item.InputDate).ToString("dd/MM/yyyy hh:mm:s tt")</span>
No comments:
Post a Comment