DateTime dt;
string a = "9/23/17";
DateTimeFormatInfo dtFormat = new DateTimeFormatInfo();
dtFormat.ShortDatePattern = "MM/dd/yy";
dt = Convert.ToDateTime(a, dtFormat);
转载于:https://www.cnblogs.com/ChengMeng/p/8662487.html
本文介绍了如何在C#中将字符串转换为特定格式的日期时间。通过使用DateTimeFormatInfo和Convert.ToDateTime方法,可以轻松地将字符串9/23/17转换为指定的MM/dd/yy格式的日期。
2764

被折叠的 条评论
为什么被折叠?



