It can be configured its way and call the changeDate
event to redeem the chosen value and format the new output, a function can be used another screen component ai is the choice, for example:
$(document).ready(function() {
$('#calendarioIni').datepicker({
format: 'dd/mm/yyyy',
startDate: '01/01/1998',
endDate: '31/12/1998',
language: 'pt-BR'
}).on('changeDate', function(e) {
$("#cid").val(e.date.toISOString().substring(0, 10));
console.log($("#cid").val());
});
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.7.1/css/bootstrap-datepicker.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.7.1/css/bootstrap-datepicker3.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.7.1/js/bootstrap-datepicker.min.js"></script><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.7.1/locales/bootstrap-datepicker.pt-BR.min.js"></script>
<input type="text" id="calendarioIni" class="form-control" name="dataInicioCalendar">
<input type="hidden" id="cid" class="form-control" name="dataInicio">
In your case, what I did, create another field input type hidden
and the value chosen in the first input
will be formatted for this input
, which can be redeemed by PHP
and used in your query , example:
<?php
$dataNormal = $_POST['dataInicioCalendar']; // A DATA FORMATO BRAZIL
$data = $_POST['dataInicio']; // A DATA AQUI É FORMATADA yyyy-MM-dd
Official Documentation >