"error converting data type nvarchar to datetime", help pls | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

"error converting data type nvarchar to datetime", help pls

string daf = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss tt"); I faced exception error that says "error converting data type nvarchar to datetime". Above are the line that produce the error. I have change it many times and follow some tips from google, but still got error. Do you guys have any idea how to do it?

17th Sep 2021, 11:56 AM
Azfar Hafiz Ahmad
Azfar Hafiz Ahmad - avatar
1 Answer
0
You're storing dates in nvarchar?
17th Sep 2021, 1:07 PM
Tim
Tim - avatar