Hi pandeygolu420...,
Please refer below sample.
Model
public class PorsonModel
{
public DateTime DOB { get; set; }
}
Controller
public class HomeController : Controller
{
public IActionResult Index()
{
return View();
}
}
View
@addTagHelper*, Microsoft.AspNetCore.Mvc.TagHelpers
@model jQuery_DatePicker.Models.PorsonModel
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.full.min.js "></script>
<script type="text/javascript">
$(function () {
$('[id*=dob]').datetimepicker({
inline: false,
showsTime: true,
format: 'Y/m/d H:i',
formatTime: 'H:i',
formatDate: 'Y/m/d',
startDate: false,
maxDate: 0,
step: 1,
closeOnDateSelect: false,
closeOnTimeSelect: true
});
});
</script>
</head>
<body>
<div class="col-lg-3 col-md-4">
<div class="form-group">
<label for="birthdate">Date of Birth<span class="text-danger">*</span></label>
<div class="input-group date datepicker-wrapper dateFieldRestrictFutureDate" id="datepicker">
@Html.TextBoxFor(c => c.DOB, new { id = "dob", @class = "form-control" })
<div class="input-group-addon">
<span><i class="fa fa-calendar"></i></span>
</div>
</div>
<span asp-validation-for="DOB" class="text-danger"></span>
</div>
</div>
</body>
</html>
Screenshot