<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>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # 如何:將字符串轉換為 DateTime(C# 編程指南) 通常程序需要支持用戶以字符串值的形式輸入日期。若要將基于字符串的日期轉換為 [System.DateTime](https://msdn.microsoft.com/zh-cn/library/system.datetime.aspx) 對象,可以使用 [Convert.ToDateTime(String)](https://msdn.microsoft.com/zh-cn/library/xhz1w05e.aspx) 方法或 [DateTime.Parse(String)](https://msdn.microsoft.com/zh-cn/library/1k1skd40.aspx) 靜態方法,如下面的示例所示。 有關日期字符串的更多示例,請參見 [Convert.ToDateTime(String)](https://msdn.microsoft.com/zh-cn/library/xhz1w05e.aspx)。 ``` // Date strings are interpreted according to the current culture. // If the culture is en-US, this is interpreted as "January 8, 2008", // but if the user's computer is fr-FR, this is interpreted as "August 1, 2008" string date = "01/08/2008"; DateTime dt = Convert.ToDateTime(date); Console.WriteLine("Year: {0}, Month: {1}, Day: {2}", dt.Year, dt.Month, dt.Day); // Specify exactly how to interpret the string. IFormatProvider culture = new System.Globalization.CultureInfo("fr-FR", true); // Alternate choice: If the string has been input by an end user, you might // want to format it according to the current culture: // IFormatProvider culture = System.Threading.Thread.CurrentThread.CurrentCulture; DateTime dt2 = DateTime.Parse(date, culture, System.Globalization.DateTimeStyles.AssumeLocal); Console.WriteLine("Year: {0}, Month: {1}, Day {2}", dt2.Year, dt2.Month, dt2.Day); /* Output (assuming first culture is en-US and second is fr-FR): Year: 2008, Month: 1, Day: 8 Year: 2008, Month: 8, Day 1 */ ``` ## 請參閱 [字符串(C# 編程指南)](https://msdn.microsoft.com/zh-cn/library/ms228362.aspx)
                  <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>

                              哎呀哎呀视频在线观看