dinger2121
Programmer
Hello,
I am trying to convert a string to datetime using the following code -
foreach (DataRow dRow in ds.Tables["task"].Rows)
{
DateTime runTime = Convert.ToDateTime(dRow["time"].ToString());
Console.WriteLine(runTime);
}
the value that is returned is in the format "MM/dd/yyyy HH:mm".
I am getting the error "String was not recognized as a valid DateTime"
Anyone have any idea what could be happening?
I am trying to convert a string to datetime using the following code -
foreach (DataRow dRow in ds.Tables["task"].Rows)
{
DateTime runTime = Convert.ToDateTime(dRow["time"].ToString());
Console.WriteLine(runTime);
}
the value that is returned is in the format "MM/dd/yyyy HH:mm".
I am getting the error "String was not recognized as a valid DateTime"
Anyone have any idea what could be happening?