获取月的:
//获取这个月的月初和月末 function getMonthStartEnd(vars){ var str = ''; if(vars!=null&&vars!=''){ var nyYear=vars.slice(0,4); var nyMonth=vars.slice(4,vars.length); var firstDay = new Date(nyYear,nyMonth-1); var lastDay = new Date(new Date(nyYear,nyMonth).valueOf()-60*60*1000*24); function datasFormat(d){ var datetime=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate(); return datetime; } str = datasFormat(firstDay) + "/" + datasFormat(lastDay) } return str }
获取年的:
//获取年的开始日期和结束日期 function getYearStartEnd(vars){ return vars+"-01-01/"+vars+"-12-31" }
顺便说一下,国内又一款开源软件Wall,搭建特别简单,可以搭建个人照片墙和视频墙,有兴趣可以看下教程:https://blog.csdn.net/u014641168/article/details/129396364