<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ~~~ /* 時間字符串格式化:把一個時間日期字符串轉化為我們想要的格式 */ // =>"2020年03月11日 14時10分00秒" // let time = '2020/3/11 14:10:0'; /* 1.把原始字符串中代表時間的值都獲取到,最后拼接成為我們想要的即可 */ /* let arr = time.split(' '); //=>["2020/3/11", "14:10:0"] let arrLeft = arr[0].split('/'); //=>["2020", "3", "11"] let arrRight = arr[1].split(':'); //=>["14", "10", "0"] // 在拼接之前,需要把ARRLEFT和ARRRIGHT中不足兩位的數字,前面補充零 arrLeft = arrLeft.map(function (item) { return item.length < 2 ? '0' + item : item; }); arrRight = arrRight.map(item => item.length < 2 ? '0' + item : item); time = `${arrLeft[0]}年${arrLeft[1]}月${arrLeft[2]}日 ${arrRight[0]}時${arrRight[1]}分${arrRight[2]}秒`; console.log(time); */ /* let arr = time.split(' '); //=>["2020/3/11", "14:10:0"] let arrLeft = arr[0].split('/'); //=>["2020", "3", "11"] let arrRight = arr[1].split(':'); //=>["14", "10", "0"] arr = arrLeft.concat(arrRight); //=>["2020", "3", "11", "14", "10", "0"] arr = arr.map(item => item.length < 2 ? '0' + item : item); time = `${arr[0]}年${arr[1]}月${arr[2]}日 ${arr[3]}時${arr[4]}分${arr[5]}秒`; console.log(time); */ /* let time = '2020/3/11 14:10:0'; // let arr = time.split(/(?: |\/|:)/g); //=>["2020", "3", "11", "14", "10", "0"] let arr = time.match(/\d+/g); //=>["2020", "3", "11", "14", "10", "0"] arr = arr.map(item => item.length < 2 ? '0' + item : item); time = `${arr[0]}年${arr[1]}月${arr[2]}日 ${arr[3]}時${arr[4]}分${arr[5]}秒`; console.log(time); */ // 不足十位補充零的操作封裝為一個方法 /* function zero(val) { return val.length < 2 ? '0' + val : val; } let time = '2020/3/11 14:10:0'; let arr = time.split(/(?: |\/|:)/g); //=>["2020", "3", "11", "14", "10", "0"] time = `${arr[0]}年${zero(arr[1])}月${zero(arr[2])}日 ${zero(arr[3])}時${zero(arr[4])}分${zero(arr[5])}秒`; console.log(time); */ /* 2.直接基于replace替換 */ /* let time = '2020/3/11 14:10:0'; time = time.replace('/', '年').replace('/', '月').replace(' ', '日 ').replace(':', '時').replace(':', '分') + '秒'; console.log(time); //=>沒有實現不足十位數字的補充零 */ /* 3.直接正則處理 */ // 封裝一個公共的,萬能的時間格式化的方法(此方法暫時不需要你們會,正式課咱們還會講) /* (proto => { function formatTime(template = '{0}年{1}月{2}日 {3}時{4}分{5}秒') { let arr = this.match(/\d+/g); return template.replace(/\{(\d+)\}/g, (_, n) => { let item = arr[n] || '0'; item.length < 2 ? item = '0' + item : null; return item; }); } proto.formatTime = formatTime; })(String.prototype); let time = '2020-3-11 14:10:0'; console.log(time.formatTime()); console.log(time.formatTime('{1}-{2} {3}:{4}')); console.log(time.formatTime('{0}年{1}月{2}日')); */ ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看