I want to change the DateTime for MySQL in C#.
My MySQL database only accept this format 1976-04-09 22:10:00.
In C# have a string who have a dat
This works for me:
1.Extract date from oracle data base and pass it to variable
string lDat_otp = "";
if (rw_mat["dat_otp"].ToString().Length <= 0)
{
lDat_otp = "";
}
else
{
lDat_otp = rw_mat["dat_otp"].ToString();
}
2.Conversion to mysql format
DateTime dateValue = DateTime.Parse(lDat_otp);
string formatForMySql = dateValue.ToString("yyyy-MM-dd HH:mm");
3.Pass formatForMySql variable to procedure or to something else