zoukankan      html  css  js  c++  java
  • 获取字符段

    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);
                  });
  • 相关阅读:
    EXCEL每次打开文件都会出现一个空白sheet1窗口
    Python基础知识之面向对象编程
    Python基础知识之模块详解
    Python基础知识之正则表达式re模块
    Python基础知识之xml模块
    Python基础知识之json&pickle模块
    Python基础知识之装饰器
    VUE-02
    VUE
    虚拟环境的搭建
  • 原文地址:https://www.cnblogs.com/1305yyf/p/6159585.html
Copyright © 2011-2022 走看看