Error: String was not recognized as a valid DateTime in VB.Net

Last Reply on Oct 26, 2016 02:14 AM By dharmendr

Posted on Oct 26, 2016 02:06 AM

  Dim mfd As Date = Date.Parse(DateString)

and in sql  field datatype is date

 

i am getting error

String was not recognized as a valid DateTime

 

 

 

Posted on Oct 26, 2016 02:14 AM

Hi yogeshc,

Like below. Out put will be only date.

Dim mfd As String = DateTime.Parse(DateTime.Now.ToString()).ToShortDateString()

Output

10/26/2016