久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <bdo id='KSoGp'></bdo><ul id='KSoGp'></ul>

    <small id='KSoGp'></small><noframes id='KSoGp'>

    1. <tfoot id='KSoGp'></tfoot>

      <legend id='KSoGp'><style id='KSoGp'><dir id='KSoGp'><q id='KSoGp'></q></dir></style></legend>

      <i id='KSoGp'><tr id='KSoGp'><dt id='KSoGp'><q id='KSoGp'><span id='KSoGp'><b id='KSoGp'><form id='KSoGp'><ins id='KSoGp'></ins><ul id='KSoGp'></ul><sub id='KSoGp'></sub></form><legend id='KSoGp'></legend><bdo id='KSoGp'><pre id='KSoGp'><center id='KSoGp'></center></pre></bdo></b><th id='KSoGp'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='KSoGp'><tfoot id='KSoGp'></tfoot><dl id='KSoGp'><fieldset id='KSoGp'></fieldset></dl></div>

      無法格式化默認的 MySQL 日期時間

      Unable to format default MySQL datetime(無法格式化默認的 MySQL 日期時間)
        <tbody id='11jtC'></tbody>
        <tfoot id='11jtC'></tfoot>

          <bdo id='11jtC'></bdo><ul id='11jtC'></ul>

            <small id='11jtC'></small><noframes id='11jtC'>

              <legend id='11jtC'><style id='11jtC'><dir id='11jtC'><q id='11jtC'></q></dir></style></legend>

                <i id='11jtC'><tr id='11jtC'><dt id='11jtC'><q id='11jtC'><span id='11jtC'><b id='11jtC'><form id='11jtC'><ins id='11jtC'></ins><ul id='11jtC'></ul><sub id='11jtC'></sub></form><legend id='11jtC'></legend><bdo id='11jtC'><pre id='11jtC'><center id='11jtC'></center></pre></bdo></b><th id='11jtC'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='11jtC'><tfoot id='11jtC'></tfoot><dl id='11jtC'><fieldset id='11jtC'></fieldset></dl></div>
                本文介紹了無法格式化默認的 MySQL 日期時間的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                我的日期從數(shù)據(jù)庫中出來是這樣的:2013-11-21 17:43:20

                我正在嘗試使用 Angular 的日期過濾器將它們變成更漂亮的東西,但是...

                {{Objected.created |日期:'shortDate'}}

                {{Objected.created |日期:'YYYY'}}

                ...只是吐出原始日期時間字符串:2013-11-21 17:43:20.沒有錯誤.我做錯了什么?

                更新我看到 MySQL 的默認日期時間與 Angular 的數(shù)據(jù)過濾器所期望的不兼容.我正在嘗試像這樣即時轉(zhuǎn)換它,但它拋出錯誤:

              1. {{ new Date(result.Job.created).toISOString() |日期:'shortDate'}}
              2. 我懷疑我無法以我嘗試的方式實例化 Date 類.錯誤是 $parse:syntax 錯誤.

                更新

                感謝@m59 的幫助,我通過一些小的調(diào)整讓它工作......

                HTML:

                ...{{Object.created |dateToISO |日期:'shortDate'}}

                JS:

                var myApp = angular.module('myApp',[]);myApp.filter('dateToISO', function() {返回函數(shù)(輸入){input = new Date(input).toISOString();返回輸入;};});

                這個自定義過濾器將默認的 MySQL 日期時間轉(zhuǎn)換為日期過濾器期望的格式,所以我發(fā)送它一個又一個然后瞧".

                解決方案

                您需要將日期字符串轉(zhuǎn)換為 Angular 支持的格式,例如 ISO 8601 格式.你可以這樣轉(zhuǎn)換:

                $scope.Object.created = new Date($scope.Object.created).toISOString();

                此處進行現(xiàn)場演示(點擊).

                要即時執(zhí)行此操作,您需要一個自定義過濾器.現(xiàn)場演示(點擊).

                標記:

                {{Object.created |dateToISO |日期:'shortDate'}}

                JavaScript:

                app.filter('dateToISO', function() {返回函數(shù)(輸入){返回新日期(輸入).toISOString();};});

                更新:

                這是一種手動轉(zhuǎn)換日期的簡單方法 (firefox):

                app.filter('badDateToISO', function() {返回函數(shù)(壞時間){var goodTime = badTime.replace(/(.+) (.+)/, "$1T$2Z");回歸美好時光;};});

                My dates come out of the database looking like this: 2013-11-21 17:43:20

                I'm trying to user Angular's date filter to turn them into something prettier, but...

                {{Objected.created | date:'shortDate'}}
                

                or

                {{Objected.created | date:'YYYY'}}
                

                ...just spits out the original datetime string: 2013-11-21 17:43:20. There are no errors. What am I doing wrong?

                Update I see that MySQL's default datetime is incompatible with what Angular's data filter expects. I'm attempting to convert it on the fly like this but it's throwing errors:

                <li ng-repeat="result in data">{{ new Date(result.Job.created).toISOString() | date:'shortDate'}}</li>
                

                I suspect I can't instantiate the Date class in the way I'm trying. The error is a $parse:syntax error.

                Update

                Thanks to @m59's help, I got it working with a few minor adjustments...

                HTML:

                <html ng-app="myApp">
                ...
                {{Object.created | dateToISO | date:'shortDate'}}
                

                JS:

                var myApp = angular.module('myApp',[]);
                
                myApp.filter('dateToISO', function() {
                  return function(input) {
                    input = new Date(input).toISOString();
                    return input;
                  };
                });
                

                This custom filter converts the default MySQL datetime into the format that the date filter expects, so I send it throw one then another and "voila".

                解決方案

                You need to convert your date string to something supported by Angular, like ISO 8601 format. You could convert it like this:

                $scope.Object.created = new Date($scope.Object.created).toISOString();
                

                Live demo here (click).

                To do this on the fly, you need a custom filter. Live demo here (click).

                Markup:

                <div>{{Object.created | dateToISO | date:'shortDate'}}</div>
                

                JavaScript:

                app.filter('dateToISO', function() {
                  return function(input) {
                    return new Date(input).toISOString();
                  };
                });
                

                Update:

                Here's a simple way to convert your date manually (firefox):

                app.filter('badDateToISO', function() {
                  return function(badTime) {
                    var goodTime = badTime.replace(/(.+) (.+)/, "$1T$2Z");
                    return goodTime;
                  };
                });
                

                這篇關(guān)于無法格式化默認的 MySQL 日期時間的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                相關(guān)文檔推薦

                SQL query to get all products, categories and meta data woocommerce/wordpress(獲取所有產(chǎn)品、類別和元數(shù)據(jù)的 SQL 查詢 woocommerce/wordpress)
                How to use MySQL in WSL (Windows Subsystem for Linux)?(如何在 WSL(Linux 的 Windows 子系統(tǒng))中使用 MySQL?)
                PowerShell MySQL Backup Script Error in Task Scheduler 0x00041301(任務(wù)計劃程序中的 PowerShell MySQL 備份腳本錯誤 0x00041301)
                Import the data from the XML files into a MySQL database(將數(shù)據(jù)從 XML 文件導(dǎo)入 MySQL 數(shù)據(jù)庫)
                installed Xampp on Windows 7 32-bit. Errors when starting(在 Windows 7 32 位上安裝 Xampp.啟動時的錯誤)
                Mysql lower case table on Windows xampp(Windows xampp 上的 Mysql 小寫表)

                    <bdo id='AI2PN'></bdo><ul id='AI2PN'></ul>
                  • <i id='AI2PN'><tr id='AI2PN'><dt id='AI2PN'><q id='AI2PN'><span id='AI2PN'><b id='AI2PN'><form id='AI2PN'><ins id='AI2PN'></ins><ul id='AI2PN'></ul><sub id='AI2PN'></sub></form><legend id='AI2PN'></legend><bdo id='AI2PN'><pre id='AI2PN'><center id='AI2PN'></center></pre></bdo></b><th id='AI2PN'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='AI2PN'><tfoot id='AI2PN'></tfoot><dl id='AI2PN'><fieldset id='AI2PN'></fieldset></dl></div>
                  • <tfoot id='AI2PN'></tfoot>
                    <legend id='AI2PN'><style id='AI2PN'><dir id='AI2PN'><q id='AI2PN'></q></dir></style></legend>
                      <tbody id='AI2PN'></tbody>

                      <small id='AI2PN'></small><noframes id='AI2PN'>

                          主站蜘蛛池模板: 羞羞视频在线观免费观看 | 国产乱码久久久久久一区二区 | 国产精品美女久久久久aⅴ国产馆 | 中文字幕99 | 免费在线观看一区二区三区 | 天天插天天搞 | 一级一级一级毛片 | 天天操天天干天天透 | 国产在线播放av | 黄色亚洲 | 亚洲精品视频一区二区三区 | 成人性视频免费网站 | 国产一区二区在线免费播放 | 91麻豆精品国产91久久久更新资源速度超快 | 日韩色图在线观看 | 99精品欧美一区二区三区 | 高清国产一区二区 | www.久久久.com| 一二三在线视频 | 久久久人 | 午夜精品视频 | 欧美中文一区 | 欧美国产视频 | 亚洲精品一区二区在线 | 午夜影视| 国产欧美一级二级三级在线视频 | 久草欧美 | 精品国产伦一区二区三区观看说明 | 欧美日韩视频在线 | 午夜免费成人 | 伊人在线视频 | 亚洲性视频 | 国产精品久久久久久久久久尿 | 欧美区在线 | 亚洲精品乱码久久久久久按摩观 | 亚洲一区二区三区视频 | 免费的一级视频 | 午夜91 | 精品伊人 | 日韩小视频 | 久久精品网 |