JavaScript日期函数大全
<mce:script type="text/javascript">
<!--
//当天
function showToDay()
{
var Nowdate=new Date();
M=Month())+1
Year()+"-"+M+"-"+Date();
}
//本周第一天
function showWeekFirstDay()
{
var Nowdate=new Date();
var WeekFirstDay=new Date(Day()-1)*86400000);
return WeekFirstDay;
}
//本周最后一天
function showWeekLastDay()
{
var Nowdate=new Date();
var WeekFirstDay=new Date(Day()-1)*86400000);
var WeekLastDay=new Date((WeekFirstDay/1000+6*86400)*1000);
return WeekLastDay;
}
//本月第一天
function showMonthFirstDay()
{
var Nowdate=new Date();
var MonthFirstDay=new Year(),Month(),1);
return MonthFirstDay;
}
//本月最后一天
function showMonthLastDay()
{
var Nowdate=new Date();
var tmpDate=new Year(),Month()+1,1);
//tmpDate.Date() -1);
//return new Year(),Month(),Date());
var MonthLastDay=new Date(tmpDate-86400000);
return MonthLastDay;
}
//本季第一天
function showquarterFirstDay()
{
var Nowdate=new Date();
Month()<3)
return new Year(),0,1);
else Month()>2 && Month()<6)
return new Year(),3,1);
else Month()>5 && Month()<9)
return new Year(),6,1);
else Month()>8)
javascript 函数 return new Year(),9,1);
}
//本季最后一天
function showquarterLastDay()
{
var Nowdate=new Date();
Month()<3)
return new Year(),2,31);
else Month()>2 && Month()<6)
return new Year(),5,30);
else Month()>5 && Month()<9)
return new Year(),8,30);
else Month()>8)
return new Year(),11,31);
}
//本年第一天
function showyearFirstDay()
{
var Nowdate=new Date();
var yearFirstDay=new Year(),0,1);
return yearFirstDay;
}
//本年最后一天
function showyearLastDay()
{
var Nowdate=new Date();
var yearLastDay=new Year(),11,31);
return yearLastDay;
}
//当前月
function showmonthCurrent()
{
var Nowdate=new Date();
var Month()+1;
Month=(Month<10)?'-0'+Month:'-'+Month;
Year()+Month;
}
//本季开始年月
function showquarterFirstMonth()
{
var Nowdate=new Date();
Month()<3)
Year()+'-01';
else Month()>2 && Month()<6)
Year()+'-04';
else Month()>5 && Month()<9)
Year()+'-07';
else Month()>8)
Year()+'-10';
}
//本季最后年月
function showquarterLastMonth()
{
var Nowdate=new Date();
Month()<3)
Year()+'-03';
else Month()>2 && Month()<6)
Year()+'-06';
else Month()>5 && Month()<9)
Year()+'-09';
else Month()>8)
Year()+'-12';
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论