C#中的可排序(“ s”)格式说明符
可排序标准格式说明符表示自定义日期和时间格式字符串。
格式字符串由DateTimeFormatInfo.SortableDateTimePattern属性定义。
自定义格式字符串。
yyyy'-'MM'-'dd'T'HH':'mm':'ss
示例
using System;class Demo {
static void Main() {
DateTime date = new DateTime(2018, 9, 5, 2, 12, 40);
Console.WriteLine(date.ToString("s"));
}
}
输出结果
2018-09-05T02:12:40
以上是 C#中的可排序(“ s”)格式说明符 的全部内容, 来源链接: utcz.com/z/317071.html