第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何生成這種時(shí)間格式?“2018-06-05T19:55:29.000+0800”

如何生成這種時(shí)間格式?“2018-06-05T19:55:29.000+0800”

慕虎7371278 2019-03-21 18:15:33
這種時(shí)間格式是怎么生成的呢?“2018-06-05T19:55:29.000+0800”目前只知道 (new Date()).toISOString()可以生成"2018-06-22T08:41:09.093Z",但是不知道上面的格式怎么搞
查看完整描述

3 回答

?
九州編程

TA貢獻(xiàn)1785條經(jīng)驗(yàn) 獲得超4個(gè)贊

時(shí)間的插件
Moment.js

其中有好多方法,可以轉(zhuǎn)換好多不同時(shí)間格式。


查看完整回答
反對(duì) 回復(fù) 2019-04-10
?
墨色風(fēng)雨

TA貢獻(xiàn)1853條經(jīng)驗(yàn) 獲得超6個(gè)贊

moment沒有直接的方案,我自己貼個(gè)方案好了。


Date.prototype.toIsoString = function() {

    var tzo = -this.getTimezoneOffset(),

        dif = tzo >= 0 ? '+' : '-',

        pad = function(num) {

            var norm = Math.floor(Math.abs(num));

            return (norm < 10 ? '0' : '') + norm;

        },

        padMilli = function(num) {

            var norm = Math.floor(Math.abs(num));

            if (norm >= 10 && norm < 100) {

                return '0' + norm;

            }

            if (norm < 10) {

                return '00' + norm;

            }

            return norm;

        };

    return this.getFullYear() +

        '-' + pad(this.getMonth() + 1) +

        '-' + pad(this.getDate()) +

        'T' + pad(this.getHours()) +

        ':' + pad(this.getMinutes()) +

        ':' + pad(this.getSeconds()) +

        '.' + padMilli(this.getMilliseconds()) +

        dif + pad(tzo / 60) + pad(tzo % 60);

}


var dt = new Date();

console.log(dt.toIsoString());


查看完整回答
反對(duì) 回復(fù) 2019-04-10
  • 3 回答
  • 0 關(guān)注
  • 1980 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)