1.前端时间插件的实战应用
年月
<input class="form-control input-datepicker" id="incomeYear" name="incomeYear" type="text" placeholder="年份" data-date-format="yyyy-mm" data-date-min-view-mode="1">
年
<input class="form-control input-datepicker" id="incomeYear" name="incomeYear" type="text" placeholder="年份" data-date-format="yyyy" data-date-min-view-mode="2">
月
<input class="form-control input-datepicker" id="incomeMonth" name="incomeMonth" type="text" placeholder="月份" data-date-format="mm" data-date-min-view-mode="1">
年月日
<input class="form-control input-datepicker" id="incomeYear" name="incomeYear" type="text" placeholder="年份" data-date-format="yyyy-mm-dd">
2. 时间日期回显当前时间的每月1号和当前的年月日
script>
$(function() {
classInfo.init("{:url('getOnlineNewstuList')}");
$("#startDate").val(getTodayDate());
$("#endDate").val(getnowDate());
});
//获取当前时间每月1号
function getTodayDate()
{
var myDate = new Date();
var thisyear = myDate.getFullYear();
var thismonth = myDate.getMonth()+1;
return thisyear+"-"+thismonth+"-01";
}
//当前时间 年/月/日
function getnowDate()
{
var myDate = new Date();
var thisyear = myDate.getFullYear();
var thismonth = myDate.getMonth() + 1;
var Day = myDate.getDate();
return thisyear+"-"+thismonth+"-"+Day;
}
</script>