日期:2014-05-16 浏览次数:20414 次
1.字符串去掉空格
String.prototype.trim? =? function()
{
??????? //? 用正则表达式将前后空格
??????? //? 用空字符串替代。
??????? return? this.replace(/(^\s*)|(\s*$)/g,? "");
}
2.得到当前年的最后一天
function getYearEnd()
{
?var strDate = "";
?var myYear,myMonth,myDay;
?
?var curDate = new Date();
?
?myYear = curDate.getYear();
?
?strDate = myYear + "-12-31";
?
?return strDate;
}
3
function addDate(d)
{
?var arys= new Array();
?arys=d.split('-');
?var day =new Number(arys[2])+1;
?var strday=day+"";
?if(strday.length==1){
? strday="0"+strday
?}
?uom = arys[0] + "-" +arys[1] + "-" + strday;
?return uom;
}