这是我的html
代码:
<div class="input-group input-medium date date-picker"
data-date=""
data-date-format="yyyy-mm-dd"
data-date-viewmode="years"
data-date-minviewmode="months"
data-date-end-date="+0d">
<input name="water.month" type="text" value="${water?.month}" class="form-control" id="months">
<span class="input-group-btn">
<button class="btn btn-info" type="button"><i class="fa fa-calendar"></i></button>
</span>
</div>
我想仅在我的日历中显示上个月。我怎么能这样做?
答案 0 :(得分:1)
如果我正确理解您的问题,您只想显示一个月(上个月)。如果是这样,试试这个:
var now = new Date();
var prevMonthFirstDate = new Date(now.getFullYear() - (now.getMonth() > 0 ? 0 : 1), (now.getMonth() - 1 + 12) % 12, 1);
var prevMonthLastDate = new Date(now.getFullYear(), now.getMonth(), 0);
$('#myDate input').datepicker({
startDate: prevMonthFirstDate,
endDate: prevMonthLastDate
});
使用Javascript:
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud1 (new pcl::PointCloud<pcl::PointXYZ>);
// Fill in the cloud data
cloud1 ->width = cloud->width;
cloud1 ->height = cloud->height;
cloud1 ->is_dense = false;
cloud1 ->points.resize(cloud->width * cloud->height);
for (size_t i = 0; i < cloud->points.size(); ++i)
{
cloud1 ->points[i].x = cloud->at(i).x;
cloud1 ->points[i].y = cloud->at(i).y;
cloud1 ->points[i].z = cloud->at(i).z;
}
要了解如何获得本月的第一天,请查看this answer
这是JSFiddle