获取字符段

1.jquery

objString = $(this).text(objString.substring(0,num) + "...")//截取指定长度字符串,超出的用省略号代替。

2.jquery获取两个日期之间所有日期

Date.prototype.format=function (){
                var s='';
                s+=this.getDay();
                s+=this.getFullYear()+'-';      // 获取年份。
                s+=(this.getMonth()+1)+"-";         // 获取月份。
                s+= this.getDate();                 // 获取日。
                return(s);                          // 返回日期。
            };
              function getAll(begin,end){
                var ab = begin.split("-");
                var ae = end.split("-");
                var db = new Date();
                db.setUTCFullYear(ab[0], ab[1]-1, ab[2]);
                var de = new Date();
                de.setUTCFullYear(ae[0], ae[1]-1, ae[2]);
                var unixDb=db.getTime();
                var unixDe=de.getTime();
                var i=0;
                for(var k=unixDb+24*60*60*1000;k<unixDe;){
                i=i+1;
                console.log((new Date(parseInt(k))).format());
                var week=
                //(new Date(parseInt(k))).format().objString.substring(0,num); 
                alert("(new Date(parseInt(k))).format()="+(new Date(parseInt(k))).format());
                k=k+24*60*60*1000;
                }
            }
              $('#iii1').click(function(){
                  $('.main3').hide();
                  $('.main4').show();
                  var date1=$('#date1').val();
                  alert(date1.getDay());
                  var date2=$('#date2').val();
                  alert(date1+"==="+date2);
                  var place=$('#place').val();
                  getAll(date1,date2);
                   alert(date1+"-="+date2+"-="+place);
              });
原文地址:https://www.cnblogs.com/1305yyf/p/6159585.html