上代码:
string dt = " 1 11 1961"; DateTime day; System.Globalization.DateTimeFormatInfo dtFormat = new System.Globalization.DateTimeFormatInfo(); dtFormat.ShortDatePattern = " M dyyyy"; day = Convert.ToDateTime(dt, dtFormat);
其中,格式表为:C#-日期格式表
2022-08-03 11:27:43
上代码:
string dt = " 1 11 1961"; DateTime day; System.Globalization.DateTimeFormatInfo dtFormat = new System.Globalization.DateTimeFormatInfo(); dtFormat.ShortDatePattern = " M dyyyy"; day = Convert.ToDateTime(dt, dtFormat);
其中,格式表为:C#-日期格式表