C#中的全日期短时间(“ f”)格式说明符
全日期短时间标准格式说明符表示长日期(“D”)和短时间(“t”)模式的组合。
UseDateTime设置日期。
DateTime myDate = new DateTime(2018, 8, 29, 1, 10, 0);
现在,使用像这样的(“f”)格式说明符-
myDate.ToString("f", CultureInfo.CreateSpecificCulture("en-US"))以下是一个例子-
示例
using System;
using System.Globalization;
class Demo {
static void Main() {
DateTime myDate = new DateTime(2018, 8, 29, 1, 10, 0);
Console.WriteLine(myDate.ToString("f",CultureInfo.CreateSpecificCulture("en-US")));
}
}输出结果
Wednesday, August 29, 2018 1:10 AM
热门推荐
10 新年门口花束祝福语简短
11 盘锦结婚祝福语大全简短
12 父母生日祝福语 简短独特
13 家庭恩爱祝福语简短英文
14 高考俄语祝福语大全简短
15 虎年祝福语 诗句唯美简短
16 生日婚礼祝福语简短精辟
17 虎年喝酒拜年祝福语简短
18 教师闺蜜祝福语简短