Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Monday, February 9, 2015 5:33 AM
Hi I am looking to convert a c# datetime in this format: 02-11-2015 18:34:32 to a MySQL table using the MySQL DateTime data type. This is the error message I currently get.
All replies (3)
Monday, February 9, 2015 5:58 AM âś…Answered | 1 vote
Are you converting the datetime value before submitting it to db?. Try the below code to convert before insert:
string res = yourdateValue.ToString("MM-dd-yyyy HH:mm:ss");
Fouad Roumieh
Monday, February 9, 2015 1:20 PM
The format of the date should be one that the db recognizes.
Use a graphic interface like phpmyadmin to see what should be the format of the date column.
Noam B.
Do not Forget to Vote as Answer/Helpful, please. It encourages us to help you...
Monday, February 9, 2015 1:21 PM
Yes that worked. I didn't realize that MySQL DateTime could take a string. Thanks!