我有一个可为空的变量Start time
Timespan? st=e.StartTime;//Null-able variable;
我正在尝试以AM/PM
格式获取时间,但我无法得到它。
DateTime date = Convert.ToDateTime(st.ToString());
String f = String.Format("{0:hh:mm:tt}", date);
错误是:
System.FormatException: String was not recognized as a valid DateTime.