C#中的月份(“ M”,“ m”)格式说明符
月标准格式说明符表示自定义日期和时间格式字符串。
格式字符串由当前的DateTimeFormatInfo.MonthDayPattern属性定义。
自定义格式字符串-
MMMM dd
示例
using System;
using System.Globalization;
class Demo {
static void Main() {
DateTime date = new DateTime(2018, 6, 11, 9, 15, 0);
Console.WriteLine(date.ToString("m", CultureInfo.CreateSpecificCulture("en-us")));
}
}输出结果
June 11