C# 中完整日期長時間 (“F”) 格式說明符


完整日期長時間的標準格式說明符的自定義日期和時間格式字串由當前的 DateTimeFormatInfo.FullDateTimePattern 屬性定義。

自定義格式字串為 −

dddd, dd MMMM yyyy HH:mm:ss

示例

 線上演示

using System;
using System.Globalization;
class Demo {
   static void Main() {
      DateTime myDate = new DateTime(2018, 8, 13, 9, 15, 0);
      Console.WriteLine(myDate.ToString("F", CultureInfo.CreateSpecificCulture("en-US")));
   }
}

輸出

Monday, August 13, 2018 9:15:00 AM

更新於: 2020 年 6 月 23 日

176 次瀏覽

開啟您的職業生涯

完成該課程進行認證

開始
廣告
© . All rights reserved.