久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      javascript如何轉(zhuǎn)換時(shí)間

      javascript轉(zhuǎn)換時(shí)間的方法:創(chuàng)建一個(gè)【util.js】文件,在里面重新封裝一下Date的format方法,代碼為【let date = new Date().Format("yyyy年M月dd日tEEEtHH:mm:ss")】。

      javascript如何轉(zhuǎn)換時(shí)間

      本教程操作環(huán)境:windows7系統(tǒng)、javascript1.8.5版,DELL G3電腦。

      javascript轉(zhuǎn)換時(shí)間的方法:

      創(chuàng)建一個(gè)util.js文件,在里面重新封裝一下Date的format方法:

      //Date的prototype 屬性可以向?qū)ο筇砑訉傩院头椒ā?   Date.prototype.Format = function(fmt) { var o = {     "M+": this.getMonth() + 1, //月份              "d+": this.getDate(), //日              "h+": this.getHours() % 12 === 0 ? 12 : this.getHours() % 12, //小時(shí)              "H+": this.getHours(), //小時(shí)              "m+": this.getMinutes(), //分              "s+": this.getSeconds(), //秒              "q+": Math.floor((this.getMonth() + 3) / 3), //季度              "S": this.getMilliseconds() //毫秒          }; var week = {     "0": "u65e5",     "1": "u4e00",     "2": "u4e8c",     "3": "u4e09",     "4": "u56db",     "5": "u4e94",     "6": "u516d" }; if (/(y+)/.test(fmt)) {     fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); } if (/(E+)/.test(fmt)) {     fmt = fmt.replace(RegExp.$1, ((RegExp.$1.length > 1) ? (RegExp.$1.length > 2 ? "u661fu671f" : "u5468") : "") + week[this.getDay() + ""]); } for (var k in o) {     if (new RegExp("(" + k + ")").test(fmt)) {         fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));     } } return fmt; };

      具體調(diào)用的時(shí)候就可以變得很方便,想要什么格式就可以形成什么格式,例如 年月日 星期幾 時(shí)分秒,做個(gè)簡(jiǎn)單的例子,如果有哪里看不明白可以評(píng)論,我看見會(huì)給你解釋的。

      let date = new Date().Format("yyyy年MM月dd日tEEEtHH:mm:ss");         $("#date-now").html(date);

      相關(guān)免費(fèi)學(xué)習(xí)推薦:javascript學(xué)習(xí)教程

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)