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

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

    <small id='89EmL'></small><noframes id='89EmL'>

      <legend id='89EmL'><style id='89EmL'><dir id='89EmL'><q id='89EmL'></q></dir></style></legend>
    1. <tfoot id='89EmL'></tfoot>

      如何將 ISO8601 TimeSpan 轉換為 C# TimeSpan?

      How do I convert an ISO8601 TimeSpan to a C# TimeSpan?(如何將 ISO8601 TimeSpan 轉換為 C# TimeSpan?)
      <tfoot id='KbaCo'></tfoot>

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

                <tbody id='KbaCo'></tbody>
            1. <legend id='KbaCo'><style id='KbaCo'><dir id='KbaCo'><q id='KbaCo'></q></dir></style></legend>

              1. <small id='KbaCo'></small><noframes id='KbaCo'>

                本文介紹了如何將 ISO8601 TimeSpan 轉換為 C# TimeSpan?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                當我嘗試執(zhí)行以下操作(例如)時,我得到了一個 System.FormatException:

                I am getting a System.FormatException when I try to do the following (as an example):

                TimeSpan ts = XmlConvert.ToTimeSpan("P72H");
                

                我調查了 ISO8601 標準,它似乎是正確的,但我無論我做什么,都無法讓它在不拋出異常的情況下解析時間.

                I've investigated the ISO8601 Standard and it seems to be correct, but I cannot get it to parse hours without throwing an exception, no matter what I do.

                謝謝!

                異常詳情:

                System.FormatException was unhandled by user code
                HResult=-2146233033
                Message=The string 'P72H' is not a valid TimeSpan value.
                Source=System.Xml
                

                推薦答案

                您需要在字符串中添加時間分隔符.試試這個:

                You need to add the Time separator to your string. Try this:

                TimeSpan ts = XmlConvert.ToTimeSpan("PT72H");
                

                查看持續(xù)時間規(guī)范 - http://www.w3.org/TR/xmlschema-2/#duration

                See the duration specification - http://www.w3.org/TR/xmlschema-2/#duration

                3.2.6.1 詞法表示
                持續(xù)時間的詞法表示是 [ISO 8601] 擴展格式 PnYn MnDTnH nMnS,其中 nY 表示年數,nM 表示月數,nD 表示天數,'T' 是日期/時間分隔符,nH 表示數字小時數,nM 分鐘數和 nS 秒數.秒數可以包含任意精度的十進制數字.

                3.2.6.1 Lexical representation
                The lexical representation for duration is the [ISO 8601] extended format PnYn MnDTnH nMnS, where nY represents the number of years, nM the number of months, nD the number of days, 'T' is the date/time separator, nH the number of hours, nM the number of minutes and nS the number of seconds. The number of seconds can include decimal digits to arbitrary precision.

                根據評論編輯/更新

                由于存在一些問題,為什么字符串 P2M2W5D 不會被視為有效的 TimeSpan,因為 W 是 ISO 8601 的一部分標準,我想添加此更新,以便如果有人遇到該問題,他們不必通讀評論即可獲得答案.對于有問題的原始字符串 P72HP2M2W5D 的問題是該字符串必須符合 W3C XML Schema(請參閱 XmlConvert.ToTimeSpan).當我們查看 W3C XML Schema(上面的鏈接)時,它引用了 ISO 8601 標準,特別是第 5.5.3.2.1 節(jié),它給出了 W 不是有效字符的原因在 XML 架構中:

                As there was some question as to why the string P2M2W5D would not be considered a valid TimeSpan since W is part of the ISO 8601 standard, I wanted to add this update so that if someone runs across that issue they don't have to read through the comments to get the answer. The issue, both for the original string in question P72H and P2M2W5D is that the string must conform to the W3C XML Schema (see the documentation for XmlConvert.ToTimeSpan). When we look at the W3C XML Schema (link above), it references back to the ISO 8601 standard, and in particular to section 5.5.3.2.1 which gives the reason why W is not a valid character in the XML Schema:

                由于周沒有明確的結轉點(52 或 53),因此周應不能在這些應用程序中使用

                Since weeks have no defined carry-over point (52 or 53), weeks should not be used in these applications

                這篇關于如何將 ISO8601 TimeSpan 轉換為 C# TimeSpan?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                相關文檔推薦

                Ignore whitespace while reading XML(讀取 XML 時忽略空格)
                XML to LINQ with Checking Null Elements(帶有檢查空元素的 XML 到 LINQ)
                Reading XML with unclosed tags in C#(在 C# 中讀取帶有未閉合標簽的 XML)
                Parsing tables, cells with Html agility in C#(在 C# 中使用 Html 敏捷性解析表格、單元格)
                delete element from xml using LINQ(使用 LINQ 從 xml 中刪除元素)
                Parse malformed XML(解析格式錯誤的 XML)

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

                  <i id='iG86P'><tr id='iG86P'><dt id='iG86P'><q id='iG86P'><span id='iG86P'><b id='iG86P'><form id='iG86P'><ins id='iG86P'></ins><ul id='iG86P'></ul><sub id='iG86P'></sub></form><legend id='iG86P'></legend><bdo id='iG86P'><pre id='iG86P'><center id='iG86P'></center></pre></bdo></b><th id='iG86P'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='iG86P'><tfoot id='iG86P'></tfoot><dl id='iG86P'><fieldset id='iG86P'></fieldset></dl></div>
                    <tfoot id='iG86P'></tfoot>
                    • <legend id='iG86P'><style id='iG86P'><dir id='iG86P'><q id='iG86P'></q></dir></style></legend>
                          <tbody id='iG86P'></tbody>
                        • <bdo id='iG86P'></bdo><ul id='iG86P'></ul>
                          主站蜘蛛池模板: 成人国产精品免费观看 | 国产免费视频在线 | 一区二区免费 | 国产人成精品一区二区三 | 欧美成人专区 | 中文字幕精品一区二区三区精品 | 99视频免费播放 | 色综合天天综合网国产成人网 | 毛片网在线观看 | 午夜精品久久久久久久星辰影院 | 亚洲视频一区在线播放 | 亚洲精品电影在线观看 | 中文在线一区二区 | 亚洲国产网址 | 日韩在线观看视频一区 | 精品视频免费 | 日韩精品免费在线 | www久久99 | 日本久久网| 欧美色图另类 | 免费毛片网站 | www.夜夜骑 | 国产精品久久 | 精品国产精品国产偷麻豆 | 久草青青草 | 亚洲二区在线 | 亚洲精品久久久久久一区二区 | 欧美一区二区三区在线看 | 日本精品网站 | 欧美一区二区网站 | 国产欧美视频一区 | 久久剧场 | 婷婷福利视频导航 | 成人av电影在线观看 | 福利电影在线 | 亚洲男人天堂网 | 亚洲欧美另类在线观看 | 国产精品国产成人国产三级 | 91爱啪啪| 热99在线 | 久久国产婷婷国产香蕉 |