var SetSearchDate = function (sign, sid, eid) {//sign 标识符区分本周本月本年,sid开始时间id,eid结束时间id var now = new Date(); var nowDayOfWeek = now.getDay(); //今天本周的第几天 var nowMonth = now.getMonth() + 1; //当前月 var nowYear = now.getFullYear(); //当前年 if (sign == 1)//本周
js 获取 本周.上周.本月.上月.本季度.上季度的开始结束日期 /** * 获取本周.本季度.本月.上月的开始日期.结束日期 */ var now = new Date(); //当前日期 var nowDayOfWeek = now.getDay(); //今天本周的第几天 var nowDay = now.getDate(); //当前日 var nowMonth = now.getMonth(); //当前月 var nowYear = now.getYear(); //当前年 no
js入门系列之 时间及时间戳 时间及时间戳 时间及时间戳是js里面很常见的一个概念,在我们写前端页面的时候,经常会遇到需要获取当前时间的情况,所以,了解js中的时间概念非常重要.而时间戳是指格林威治时间1970年01月01日00时00分00秒(北京时间1970年01月01日08时00分00秒)起至现在的总秒数,在关于时间的计算中也起着不可替代的作用.下面我们通过代码来认识一下他们.首先,我们先通过代码获取当前时间: var time=new Date(); var timeTamp=time.g
function dateChange(name){ var beginTimeObject = document.getElementById("beginTime"); var endTimeObject = document.getElementById("endTime"); var beginTime; var endTime; var now = new Date(); var month = now.getMonth(); var year = now
涉及到显示本月或本周相关信息,又不想让php去判断,只好直接用js去计算,麻烦了好一阵,还是老老实实的看了下js的日期函数.现总结一下: //计算本周起始日期,并以 Y-m-d 形式返回. function getWeekTime() { var now = new Date(); var Year = now.getFullYear(); var Month = now.getMonth() + 1; var Day = now.
/** * 针对时间的工具类 */ var DateTimeUtil = function () { /*** * 获得当前时间 */ this.getCurrentDate = function () { return new Date(); }; /*** * 获得本周起止时间 */ this.getCurrentWeek = function () { //起止日期数组 var startStop = new Array(); //获取当前时间 var currentDate = this
/** * 获取本周.本季度.本月.上月的开始日期.结束日期 */ var now = new Date(); //当前日期 var nowDayOfWeek = now.getDay(); //今天本周的第几天 var nowDay = now.getDate(); //当前日 var nowMonth = now.getMonth(); //当前月 var nowYear = now.getY