I am using C# code for inserting record and datetimepicker control for Date I want to insert Date like 24-05-2010 in MySQL Database What Datatype i have to use for that in MySQL table
and how to right insert query for to insert date?
I am using C# code for inserting record and datetimepicker control for Date I want to insert Date like 24-05-2010 in MySQL Database What Datatype i have to use for that in MySQL table
and how to right insert query for to insert date?
You should use the DATE datatype, which by default will retrieve it as 2010-05-24 when you get the value as a string. If you need that specific format you mentioned, you can either store it as a VARCHAR(10) or use a function (e.g. DATE_FORMAT('%d-%m-%y')
) when getting the value from the table.
No, you don't want it :) Are you really concerned of the format in which data will be stored?
I am sure you want to use 2010-05-24
format and date date
field type.
While if you want to display it back in your own format, you can use a date_format()
function in your SELECT query