I have data from API where date format is yyyy-mm-dd. I have added a bootstrap date range picker plugin whose date format is dd/mm/yyyy.
<script type="text/javascript">
$(document).ready(function (){
$('#from').datepicker({
format: "dd/mm/yyyy"
});
$('#to').datepicker({
format: "dd/mm/yyyy"
});
});
I want to show data by filtering date range. help me.
function show_date(){
if ($("#from").val().length == 0 || $("#to").val().length == 0) {
alert('All fields are required');
} else {
alert($("#from").val() + ' to ' + $("#to").val());
}
}
$('.datepicker').datepicker({
dateFormat: 'yy-mm-dd'
});
Source . I have extracted it from here. You can get full year with 'yy'.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.