How to change Bootstrap Datepicker with specific date format

Share Me
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Hello to Dev’s today now in this post i will show you How to change Bootstrap Datepicker with specific date format? We know that bootstrap is a very popular html css framework. By using Bootstrap we can make the batter responsive design. If we have need datepicker with our date format as like yyyy-mm-dd, yyyy/mm/dd, dd/mm/yyyy, dd-mm-yyyy etc then we can do this very easily. So if we want to set the date format then we have to just add one argument on format and it will add format as we want as like as bellow example.

So let’s start and see the bellow example.

Example:
<html lang="en">
<head>
    <title>Bootstrap Datepicker with format Example</title>  
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css" rel="stylesheet">
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>  
        <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script>  
</head>
<body>

<input class="date form-control" style="width: 300px;" type="text">

<script type="text/javascript">
    $('.date').datepicker({
       format: 'yyyy-mm-dd'
     });
</script>

</body>
</html>

Read Also : Generate Captcha code and Validation by using BotDetect package in laravel

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

About code chef

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 code chef →