3
Answers

Getting the conversion of datetime error

prasanna p

prasanna p

1y
464
1

Hi friends,

I am assigning API datetime value to a string like the below in our .net core project.

string strdate = Convert.ToString(token["Receipt Date"]) + " " + Convert.ToString(token["Transaction Time"]);

I am inserting into the table like the below.this worked these many days without fail.

  cmd.Parameters.AddWithValue("@Saledatetime",Convert.ToDateTime(strdate));

But now when I am using Convert.ToDateTime(strdate) it is giving the value {2023-11-27 12:41:04}.

So getting the error while insertion.In the string it is coming value 2023-11-27 12:41:04 Why the  curly braces { } coming fter converting string to datetime.

Please tell me how to resolve this?

Answers (3)