在引导日期分页器中仅获取选定的日期 [英] Getting only selected date in bootstrap-date paginator
本文介绍了在引导日期分页器中仅获取选定的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用bootstrap-datepaginator 来源.
I am using bootstrap-datepaginator Source.
下面的代码以Sun Aug 14 2016 00:00:00 GMT+0400
相反,我要以这种格式14/Aug/2016
Instead of that i want to return it in this format 14/Aug/2016
<script>
$(document).ready(function () {
var options = {
selectedDate: '2016-01-01',
selectedDateFormat: 'YYYY-MM-DD'
}
$('#paginator').datepaginator(options);
$('#paginator').datepaginator();
$('#paginator').on('selectedDateChanged', function (event, date) {
// Your logic goes here
alert(date);
});
});</script>
推荐答案
尝试一下
var months = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Ntove", "Dec" ];
var dati = "Sun Aug 14 2016 00:00:00 GMT+0400";
var date = new Date(dati);
var thedate = date.getDate();
var themonth = date.getMonth();
var theyear = date.getFullYear();
alert(thedate);
alert(themonth);
alert(theyear);
var newdate = thedate +"/"+months[themonth]+"/"+theyear;
alert(newdate);
工作示例
<html>
<head></head>
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<body>
</body>
<script type="text/javascript">
var months = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Ntove", "Dec" ];
var dati = "Sun Aug 14 2016 00:00:00 GMT+0400";
var date = new Date(dati);
var thedate = date.getDate();
var themonth = date.getMonth();
var theyear = date.getFullYear();
alert(thedate);
alert(themonth);
alert(theyear);
var newdate = thedate +"/"+months[themonth]+"/"+theyear;
alert(newdate);
</script>
</html>
这篇关于在引导日期分页器中仅获取选定的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文