Bootstrap year picker example using datepicker js

Today now in this post i will talk about Bootstrap year picker example using datepicker js. In generally we are always use datepicker with the dd-mm-yyyy format but in sometimes we need to get only year value, Here i mean that select only the year so at that time we need to use the datepicker option as like as format, minViewMode etc so on that way we can make the datepicker into year picker for us.

Now in this example i will give an example of how can we can get year picker, so here i will use two option from datepicker function here one format and other minViewMode, by the default minViewMode is for datepicker, if we have to use 1 then it is for month picker and use 2 for year picker.

so let’s run the bellow example or we can see demo as well as:

<html lang="en">

    <title>Bootstrap - year picker only example</title>
    <link href="" rel="stylesheet">
    <link href="" rel="stylesheet">
    <script src=""></script>
    <script src=""></script>  
    <script src=""></script>


<div class="container text-center">

     <h2>Bootstrap - year picker only example</h2>
     <input class="date-own form-control" style="width: 300px;" type="text">

  <script type="text/javascript">
         minViewMode: 2,
         format: 'yyyy'



Read Also : How to Create Custom Blade Directive in Laravel?

Thanks for read. I hope it help you. For more you can follow us on facebook.


About Shahriar Sagor

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Shahriar Sagor →