2013-08-29 263 views
-1
Dim value As String = "29/08/2013 12:00:00 A8P8" 
Dim time As DateTime = DateTime.ParseExact(value, "dd/MM/yyyy", Nothing) 

错误字符串未被识别为有效的DateTime。 如何格式化字符串的日期格式字符串日期格式

回答

0

尝试

DateTime.ParseExact(Left(value, 10), "dd/MM/yyyy", Nothing) 
0

试试这个,不是最好的,但工程。

Dim value As String = "29/08/2013 12:00:00 A8P8"; 

//删除多余的部分

aa = aa.Substring(0, 19); 
Dim time As DateTim = DateTime.ParseExact(aa, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None); 
0
Format(CDate(value.Substring(1, 10)), "dd/MM/yyyy")