In this article I will explain with an example, how to implement Bootstrap TimePicker in ASP.Net Core MVC.
Note: For beginners in ASP.Net Core 7, please refer my article ASP.Net Core 7: Hello World Tutorial with Sample Program example.
 
 
Download Bootstrap TimePicker Plugin
You will need to download the plugin files from the following location.
 
 
Controller
The Controller consists of following Action methods.
Action method for handling GET operation
Inside this Action method, simply the View is returned.
 
Action method for handling POST operation
This Action method gets called when the Submit Button is clicked.
Inside this Action method, the selected time is fetched and set into a ViewBag object.
public class HomeController : Controller
{
    public IActionResult Index()
    {
        return View();
    }
 
    [HttpPost]
    public IActionResult Index(string selectedTime)
    {
        ViewBag.Message = selectedTime;
        return View();
    }
}
 
 
View
Inside the View, first the ASP.Net TagHelper is inherited.
The View consists of an HTML Form which has been created using the ASP.Net TagHelpers with the following attributes.
asp-action – Name of the Action. In this case the name is Index.
asp-controller – Name of the Controller. In this case the name is Home.
method – It specifies the Form Method i.e. GET or POST. In this case it will be set to POST.
The following HTML Form consists of a TextBox and a Submit Button.
 
Bootstrap TimePicker Plugin implementation
Inside the View, the following Bootstrap CSS files are inherited.
1. bootstrap.min.css
2. bootstrap-datetimepicker.min.css 
And then, the following jQuery, Bootstrap DateTimePicker and locales JS files are inherited.
1. jquery.min.js
2. moment-with-locales.js
3. bootstrap.min.js
4. bootstrap-datetimepicker.min.js
 
Inside the jQuery document ready event handler, the TextBox has been applied with the Bootstrap TimePicker plugin.
The format property of TimePicker plugin is set to LT.
 
Submitting the Form
When the Time is selected and the Submit button is clicked, the Form is submitted and the ViewBag object is checked for NULL and if it is not NULL then, the value of the ViewBag object is displayed using JavaScript Alert Message Box.
@addTagHelper*, Microsoft.AspNetCore.Mvc.TagHelpers
@{
    Layout = null;
}
 
<!DOCTYPE html>
 
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
</head>
<body>
    <form method="post" asp-controller="Home" asp-action="Index">
        <div class="form-group" style="margin: 30px">
            <div class="input-group date" style="width: 200px">
                <input type="text" name="selectedTime" id="txtTime" class="form-control"/>
                <span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
            </div>
            <br />
            <input type="submit" value="Submit" />
        </div>
    </form>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.7.14/css/bootstrap-datetimepicker.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment-with-locales.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.7.14/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $('[id*=txtTime]').datetimepicker({
                format: 'LT'
            });
        });
    </script>
    @if (ViewBag.Message != null)
    {
        <script type="text/javascript">
            $(function () {
                alert("@ViewBag.Message");
            });
        </script>
    }
</body>
</html>
 
 
Screenshot
ASP.Net Core: Implement Bootstrap TimePicker
 
 
Demo
 
 
Downloads